Author: Not specified Language: cpp
Description: (v2) Timestamp: 2018-07-03 16:35:41 +0000
View raw paste Parent paste by: Not specified Reply
  1. unsigned long lastMillisSend = 0;
  2. int steering_angle = 1000;
  3. float set_velocity = 0;
  4. int brake = 0;
  5.  
  6. void setup() {
  7.   Serial.begin(9600);
  8.  
  9. }
  10.  
  11. void loop() {
  12.  
  13.   if ( millis() - lastMillisSend > 10 )
  14.   {
  15.     Serial.print("$#" + String(steering_angle) + "#" + String(set_velocity, 2) + "#" + String(brake) + "\n");
  16.     lastMillisSend = millis();
  17.   }
  18.   if ( --steering_angle < 0)
  19.     steering_angle = 100;
  20.  
  21.   if ( (set_velocity += 0.465) > 28.0 )
  22.     set_velocity = 0;
  23.  
  24.    if ( brake++ == 1)
  25.     brake = 0;
  26. }
View raw paste Parent paste by: Not specified Reply