Commits

iorodeo committed 756e7bb

Added stop.

Comments (0)

Files changed (2)

matlab_serial_interface/PanelsNano.m

          
         function setFrameDt(self,dt)
             % Set the frame dt in ms 
-            if (dt < 1) || (dt > 255)
+            if (dt < 0) || (dt > 255)
                 error('frame dt must be between 1 and 255');
             end
             fwrite(self.dev, char(dt));    
       
     end
     
-end
+end

panels_controller_nano_firmware.pde

 void loop() {
   while (Serial.available() > 0) {
     uint8_t byte = (uint8_t) Serial.read();
-    if (byte > 0) {
+    if (byte >= 0) {
       ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
         maxDelayCnt = byte;
         delayCnt = 0;
       }
     }
   }
-  if (sendFrame == true) {
+  if ((maxDelayCnt > 0) && (sendFrame == true)) {
     Wire.beginTransmission(GENERAL_CALL_ADDRESS); // transmit to all devices
     Wire.send(PATTERN[frame_n],INITIAL_PATTERN_BYTE_COUNT);
     Wire.endTransmission();    // stop transmitting