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.
Dependencies: CANBuffer KS0108_fork mbed-rtos mbed CAN Addresses
Fork of REVO_Updated_Steering by
Revision 7:df257df56363, committed 2014-10-04
- Comitter:
- palimar
- Date:
- Sat Oct 04 17:57:44 2014 +0000
- Parent:
- 5:05f8a36b5cdd
- Parent:
- 6:99e754ac888f
- Child:
- 8:57f279f486d9
- Commit message:
- Merged the two tips.
Changed in this revision
| Steering.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/Steering.cpp Sat Oct 04 17:55:27 2014 +0000
+++ b/Steering.cpp Sat Oct 04 17:57:44 2014 +0000
@@ -194,11 +194,25 @@
return;
}
+void display_speed_data(void const *args) {
+ while (true) {
+ display.GotoXY(10,16);
+ display.SelectFont(Arial_14,BLACK,ReadData);
+ char buf[10];
+ int a = rand()%100;
+ sprintf(buf, "%d", a);
+ display.PrintString("Speed: ");
+ display.PrintString(buf);
+ display.PrintString("mph");
+ }
+}
+
+
void ON()
{
Txmsg_Drive.data[0]|=(1<<0);
wait(0.1);
-
+
display.ClearScreen();
display.SelectFont(Arial12,BLACK,ReadData);
display.GotoXY(26,16);
@@ -218,7 +232,6 @@
display.GotoXY(16,16);
display.PrintString(" RESET INITIATED");
printf("Reset Initiated\n\r");
- //screen=0;
return;
}
@@ -233,8 +246,9 @@
{
if(Rxmsg.id == BATTERY_POWER_ID)
{
- for(int i=0; i<4; i++)
+ for(int i=0; i<4; i++){
rcv.C_FLOAT[i]=Rxmsg.data[i];
+ }
power_ratio=rcv.FLOAT/80000;
ledstream.write(power_ratio);
}
@@ -245,8 +259,9 @@
{
pc.baud(230400);
CAN_Steering.frequency(500000);
- for(int i = 0; i<4; i++)
+ for(int i = 0; i<4; i++){
drive[i] = (0x00);
+ }
ledstream.write(0);
call_ledstream.attach(&Powerstream,0.1);
}
@@ -261,6 +276,10 @@
display.GotoXY(10,16);
display.SelectFont(Arial_14,BLACK,ReadData);
display.PrintString("Penn Electric Racing");
+
+ wait(1);
+
+ Thread thread(display_speed_data);
// Start to read buttons on main thread
screen=0;
