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