Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
8 years, 5 months ago.
The device is acting strange. It is not executing the program line by line?
I tried several codes: It is not considering switch case, do/while or any other function. In the program below it doesn't execute one by line instead jumps to if statement at line 252. Please help.
#include "mbed.h" #include "TextLCD.h" DigitalOut myled(LED3); DigitalIn butt(D3); DigitalIn butt1(D4); TextLCD lcd(A0, A1, A2, A3, A4, A5); int main() { int i = 0; butt.mode(PullDown); butt1.mode(PullDown); do { if (butt == 1) { i++; wait(1); lcd.cls(); lcd.locate(3,0); lcd.printf("Ran %d",i); myled = 1; // LED is ON } } while(butt1 == 0); lcd.cls(); lcd.locate(3,0); lcd.printf("out"); myled = 0; }
Question relating to:
2 Answers
8 years, 5 months ago.
Check the solderbridges on the L031 (table 7 in the manual). There are some solderlinks between the D4 pin and the A4 pin (SB18), there are also links between D5 and A5 (SB16). The bridge SB18 leads to shorts between butt1 and the LCD. So you will get some random characters or maybe some random keypresses on butt1 depending on the displaydata.
The SB links are there to provide compatibility with the arduino mini layout by supporting I2C on A4,A5. Just remove the links or select another digital input instead of D4.
8 years, 5 months ago.
Make your program simpler by removing statements and/or adding printf statements to see how it flows. We can't really help you with something like that which depends on alot of pin states.
I cant understand the reason that why is this code not working on this device when it was working fine on the stm l152RE. This device is not even expecting any function, I will put a new command which also dont work properly. The function ends as soon the value of i reaches more than 4. and if I press start before 4 the screen does not refresh correctly and all the numbers are scrambled.
posted by 09 Jun 2016