Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: main.cpp
- Revision:
- 21:5c6b3657c3cb
- Parent:
- 20:ec9d4f6a16ac
diff -r ec9d4f6a16ac -r 5c6b3657c3cb main.cpp --- a/main.cpp Sat Oct 19 02:10:12 2019 +0000 +++ b/main.cpp Sat Feb 22 04:53:57 2020 +0000 @@ -35,6 +35,7 @@ EEPROM ep(SDA,SCL,EEPROM_ADDR,EEPROM::T24C32); extern void eeprom_test(void); #ifdef YODA2 +Serial uart1(PC_4, PC_5); // tx, rx // I2C Communication I2C i2c_lcd(LCD_SDA, LCD_SCL); // SDA, SCL TextLCD_I2C_N lcd(&i2c_lcd, ST7032_SA, TextLCD::LCD16x2, NC, TextLCD::ST7032_3V3); @@ -405,7 +406,7 @@ int year; DS3231 rtc_test(SDA, SCL); // DS3231 rtc_test(PF_0, PF_1); - printf("\r\n\nDS3231 Library test program\r\nremi cormier 2012\r\n\n"); +// printf("\r\n\nDS3231 Library test program\r\nremi cormier 2012\r\n\n"); rtc_test.setI2Cfrequency(400000); @@ -433,8 +434,9 @@ rtc_test.setDate(6,22,12,2012); // uncomment to set date #endif - - printf("\n\n*** RTOS starts ***\r\n"); + uart1.baud(115200); + uart1.printf("\n\n*** Hello Yoda2! ***\r\n"); + printf("\n\n*** Hello Yoda2! ***\r\n"); // wait(1); #if 1 @@ -508,21 +510,38 @@ // scaleCalibration(true); switch (device_type_v) { - case CupTrack: + case CupTrack: + lcd.setAddress(0,1); + lcd.printf("CupTrack "); + break; case JamTrack: + lcd.setAddress(0,1); + lcd.printf("JamTrack "); + break; case TeaTrack: + lcd.setAddress(0,1); + lcd.printf("TeaTrack "); break; case Tea: + lcd.setAddress(0,1); + lcd.printf("Tea "); + init_scale(); + scale_thread.start(scale_reading); + break; case Jam: + lcd.setAddress(0,1); + lcd.printf("Jam "); init_scale(); scale_thread.start(scale_reading); break; case Shaker: + lcd.setAddress(0,1); + lcd.printf("Shaker "); break; default: break; } - + lcd.printf("%d", device_address); mainmenu_thread.start(main_menu); #endif @@ -530,10 +549,18 @@ wait(2); while(1) { wait(2); +#if 1 + printf("Sensors:\r\n"); + printf("%d %d %d %d \r\n", din1.read(), din2.read(), din3.read(), din4.read()); + printf("%d %d %d %d \r\n", din5.read(), din6.read(), din7.read(), din8.read()); + printf("Sensors:\r\n"); + printf("%d %d %d %d \r\n", din1.read(), din2.read(), din3.read(), din4.read()); + printf("%d %d %d %d \r\n", din5.read(), din6.read(), din7.read(), din8.read()); +#endif #if 0 distance = 0; distance = moveMotor3Until(true, din5); - printf("F distance=%d \r\n", distance); + printf("F distance=%d \r\n", distance); printf("Sensors:\r\n"); printf("%d %d %d %d \r\n", din1.read(), din2.read(), din3.read(), din4.read()); printf("%d %d %d %d \r\n", din5.read(), din6.read(), din7.read(), din8.read());