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.
Revision 21:5c6b3657c3cb, committed 2020-02-22
- Comitter:
- hi1000
- Date:
- Sat Feb 22 04:53:57 2020 +0000
- Parent:
- 20:ec9d4f6a16ac
- Commit message:
- Latest codes
Changed in this revision
--- a/DS3231.lib Sat Oct 19 02:10:12 2019 +0000 +++ b/DS3231.lib Sat Feb 22 04:53:57 2020 +0000 @@ -1,1 +1,1 @@ -DS3231#084c63e7e80d +https://os.mbed.com/users/hi1000/code/DS3231/#084c63e7e80d
--- 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());
--- a/payload.cpp Sat Oct 19 02:10:12 2019 +0000 +++ b/payload.cpp Sat Feb 22 04:53:57 2020 +0000 @@ -270,7 +270,7 @@ { int can_id; int init_weight; - int needed_weight; + int weight; int loop; switch (data_pack.cmd) { @@ -287,9 +287,9 @@ break; case COMMAND_PLUS: init_weight = current_weight; - needed_weight = data_pack.value1; - printf("init_weight:%dg needed_weight:%dg\r\n", init_weight, needed_weight); - while ((current_weight - init_weight) <= needed_weight) + weight = data_pack.value1; + printf("init_weight:%dg needed_weight:%dg\r\n", init_weight, weight); + while ((current_weight - init_weight) <= weight) { printf("still need to plus weight %dg \r\n", (current_weight - init_weight)); }
--- a/yoda2.h Sat Oct 19 02:10:12 2019 +0000 +++ b/yoda2.h Sat Feb 22 04:53:57 2020 +0000 @@ -85,6 +85,8 @@ #define LCD_SCL PB_8 // I2C SCL pin #define SCALE_SDA PA_1 #define SCALE_SCL PA_0 +#define SCALE2_SDA PF_1 +#define SCALE2_SCL PA_0 #define CAN_RD PA_11 #define CAN_TD PA_12 #define DIN1 PC_0