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 13:1f05dcd9ae0e, committed 2014-10-18
- Comitter:
- palimar
- Date:
- Sat Oct 18 17:05:39 2014 +0000
- Parent:
- 9:e946cafa3cae
- Child:
- 15:da14227cdd1d
- Commit message:
- Added code to send multiple change status requests
Changed in this revision
| Steering.cpp | Show annotated file Show diff for this revision Revisions of this file |
| Steering.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/Steering.cpp Sat Oct 18 16:36:44 2014 +0000
+++ b/Steering.cpp Sat Oct 18 17:05:39 2014 +0000
@@ -209,19 +209,29 @@
void request_status_change()
{
- //drive_status != drive_status;
- //wait(0.1);
+
+ char drive_status_request = !drive_status;
+ char * status_string;
- //char status_string = (drive_status == 1 ? "ON" : "OFF");
+ if(drive_status_request){
+ status_string = "ON";
+ }
+ else{
+ status_string = "OFF";
+ }
+
+ for(int i = 0; i < 10; i++){
+ CAN_Steering.write(Txmsg_drive_status_request);
+ }
display.ClearScreen();
display.SelectFont(Arial12,BLACK,ReadData);
display.GotoXY(26,16);
- display.PrintString("REQUEST SENT TO CHANGE DRIVE STATUS TO ");
- printf("DRIVE STATUS CHANGE Initiated\n\r");
+ display.PrintString("REQUEST SENT TO CHANGE DRIVE STATUS TO: ");
+ display.PrintString(status_string);
+ display.PrintString(".\n");
-
-
+ printf("DRIVE STATUS CHANGE Initiated\n\r");
return;
}
@@ -260,6 +270,7 @@
pc.baud(230400);
CAN_Steering.frequency(500000);
drive_status = 0;
+ drive_status_request = 1;
reset_body = 0;
ledstream.write(0);
call_ledstream.attach(&Powerstream,0.1);
--- a/Steering.h Sat Oct 18 16:36:44 2014 +0000 +++ b/Steering.h Sat Oct 18 17:05:39 2014 +0000 @@ -104,9 +104,10 @@ int screen; char drive_status; +char drive_status_request; char reset_body; -CANMessage Txmsg_drive_status(0x501,&drive_status,1); +CANMessage Txmsg_drive_status_request(0x501,&drive_status_request,1); CANMessage Txmsg_reset(0x502,&reset_body,1); #endif /* STEERING_H */ \ No newline at end of file
