File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -55,8 +55,8 @@ const byte kD5Pin = 5;
5555const byte kD6Pin = 6 ;
5656const byte kD7Pin = 7 ;
5757
58- long lastSensorValuesWrittenMark = 0 ; // Remember the last time data was send
59- int sensorSampleInterval = 40 ; // Send sensor date every N milliseconds
58+ unsigned long lastSensorValuesWrittenMark = 0 ; // Remember the last time data was send
59+ unsigned long sensorSampleInterval = 40 ; // Send sensor date every N milliseconds
6060
6161// Setup function
6262void setup ()
@@ -122,9 +122,11 @@ void MapSensorToActuator()
122122void SerialWriteSensorValues ()
123123{
124124 // Let's send max 25 times per second
125- if (millis () > (lastSensorValuesWrittenMark + sensorSampleInterval))
125+ unsigned long timeNow = millis ();
126+ if (timeNow > (lastSensorValuesWrittenMark + sensorSampleInterval))
126127 {
127128 // Send all values on one line separated by spaces to Max
129+
128130 Serial.print (" s " );
129131 Serial.print (A0_value);
130132 Serial.print (" " );
@@ -134,7 +136,7 @@ void SerialWriteSensorValues()
134136 Serial.print (" " );
135137 Serial.print (A3_value);
136138 Serial.print (" \n " );
137- lastSensorValuesWrittenMark = millis () ;
139+ lastSensorValuesWrittenMark = timeNow ;
138140 }
139141}
140142
@@ -348,4 +350,4 @@ void DoLightShow()
348350 leds.setColorRGB (i, 0 , 0 , 0 );
349351 delay (100 );
350352}
351-
353+
You can’t perform that action at this time.
0 commit comments