Skip to main content
added 336 characters in body
Source Link
             unsigned long codeTime = 0; //The time the sketch takes to execute
         static unsigned long char uint16_tdataArray dataArray[1];[1]; // a variable to hold both sensor data

         void setup(){
              Serial.begin(9600);
              Serial1.begin(9600);
          }
         void state1(){
             if (Serial1.available()){
                    while (Serial1.available() > 0){
                 codeTime = millis(); //using the millis() instead of micros()             
                 dataArray[0]//memcpy =should codeTime;copy the whole data into position 0 ????
                 intmemcpy(&dataArray[0], newByte&codeTime,sizeof(codeTime));
                 uint16_t newByte1 = Serial1.read(); // read in the first byte
                 uint16_t newByte2 = Serial1.read(); //read in the second byte
                 uint16_t dataByte = newByte2 >> 8;
                 dataByte = (dataByte | newByte1);
                 dataArray[1] = newByte;dataByte;
                 Serial1.write((uint16_t*)dataArray, sizeOf(dataArray));
                 }
               }
              }

            void loop(){
                   state1();
                   Serial1.flush();  //clear the serial port 
                   delay(100);
                }
                
             unsigned long codeTime = 0; //The time the sketch takes to execute
             uint16_t dataArray[1]; // a variable to hold both sensor data

         void setup(){
              Serial.begin(9600);
              Serial1.begin(9600);
          }
         void state1(){
             if (Serial1.available()){
                    while (Serial1.available() > 0){
                 codeTime = millis(); //using the millis() instead of micros()
                 dataArray[0] = codeTime;
                 int newByte = Serial1.read(); // read in the first byte
                 dataArray[1] = newByte;
                 Serial1.write((uint16_t*)dataArray, sizeOf(dataArray));
                 }
               }
              }

            void loop(){
                   state1();
                   Serial1.flush();  //clear the serial port 
                   delay(100);
                }
                
             unsigned long codeTime = 0; //The time the sketch takes to execute
         static unsigned long char dataArray [1]; // a variable to hold both sensor data

         void setup(){
              Serial.begin(9600);
              Serial1.begin(9600);
          }
         void state1(){
             if (Serial1.available()){
                    while (Serial1.available() > 0){
                 codeTime = millis(); //using the millis() instead of micros()             
                 //memcpy should copy the whole data into position 0 ????
                 memcpy(&dataArray[0], &codeTime,sizeof(codeTime));
                 uint16_t newByte1 = Serial1.read(); // read in the first byte
                 uint16_t newByte2 = Serial1.read(); //read in the second byte
                 uint16_t dataByte = newByte2 >> 8;
                 dataByte = (dataByte | newByte1);
                 dataArray[1] = dataByte;
                 Serial1.write((uint16_t*)dataArray, sizeOf(dataArray));
                 }
               }
              }

            void loop(){
                   state1();
                   Serial1.flush();  //clear the serial port 
                   delay(100);
                }
                
added 23 characters in body
Source Link
             unsigned long codeTime = 0; //The time the sketch takes to execute
             static charuint16_t buffer[1];dataArray[1]; // a variable to hold both sensor data

         void setup(){
              Serial.begin(9600);
              Serial1.begin(9600);
          }
         void state1(){
             if (Serial1.available()){
                    while (Serial1.available() > 0){
                 codeTime = millis(); //using the millis() instead of micros()
                 buffer[0]dataArray[0] = codeTime;
                 int newByte = Serial1.read(); // read in the first byte
                 buffer[1]dataArray[1] = newByte;
                 Serial1.write(buffer(uint16_t*)dataArray, sizeOf(bufferdataArray));
                 }
               }
              }

            void loop(){
                   state1();
                   Serial1.flush();  //clear the serial port 
                   delay(100);
                }
                
             unsigned long codeTime = 0; //The time the sketch takes to execute
             static char buffer[1]; // a variable to hold both sensor data

         void setup(){
              Serial.begin(9600);
              Serial1.begin(9600);
          }
         void state1(){
             if (Serial1.available()){
                    while (Serial1.available() > 0){
                 codeTime = millis(); //using the millis() instead of micros()
                 buffer[0] = codeTime;
                 int newByte = Serial1.read(); // read in the first byte
                 buffer[1] = newByte;
                 Serial1.write(buffer, sizeOf(buffer));
                 }
               }
              }

            void loop(){
                   state1();
                   Serial1.flush();  //clear the serial port 
                   delay(100);
                }
                
             unsigned long codeTime = 0; //The time the sketch takes to execute
             uint16_t dataArray[1]; // a variable to hold both sensor data

         void setup(){
              Serial.begin(9600);
              Serial1.begin(9600);
          }
         void state1(){
             if (Serial1.available()){
                    while (Serial1.available() > 0){
                 codeTime = millis(); //using the millis() instead of micros()
                 dataArray[0] = codeTime;
                 int newByte = Serial1.read(); // read in the first byte
                 dataArray[1] = newByte;
                 Serial1.write((uint16_t*)dataArray, sizeOf(dataArray));
                 }
               }
              }

            void loop(){
                   state1();
                   Serial1.flush();  //clear the serial port 
                   delay(100);
                }
                
added 2 characters in body
Source Link
             unsigned long codeTime = 0; //The time the sketch takes to execute
             static char buffer[1]; // a variable to hold both sensor data

         void setup(){
              Serial.begin(9600);
              Serial1.begin(9600);
          }
         void state1(){
             if (Serial1.available()){
                    while (Serial1.available() > 0){
                 codeTime = millis(); //using the millis() instead of micros()
                 buffer[0] = millis;codeTime;
                 int newByte = Serial1.read(); // read in the first byte
                 buffer[1] = newByte;
                 Serial1.write(buffer, sizeOf(buffer));
                 }
               }
              }

            void loop(){
                   state1();
                   Serial1.flush();  //clear the serial port 
                   delay(100);
                }
                
             unsigned long codeTime = 0; //The time the sketch takes to execute
             static char buffer[1]; // a variable to hold both sensor data

         void setup(){
              Serial.begin(9600);
              Serial1.begin(9600);
          }
         void state1(){
             if (Serial1.available()){
                    while (Serial1.available() > 0){
                 codeTime = millis(); //using the millis() instead of micros()
                 buffer[0] = millis;
                 int newByte = Serial1.read(); // read in the first byte
                 buffer[1] = newByte;
                 Serial1.write(buffer, sizeOf(buffer));
                 }
               }
              }

            void loop(){
                   state1();
                   Serial1.flush();  //clear the serial port 
                   delay(100);
                }
                
             unsigned long codeTime = 0; //The time the sketch takes to execute
             static char buffer[1]; // a variable to hold both sensor data

         void setup(){
              Serial.begin(9600);
              Serial1.begin(9600);
          }
         void state1(){
             if (Serial1.available()){
                    while (Serial1.available() > 0){
                 codeTime = millis(); //using the millis() instead of micros()
                 buffer[0] = codeTime;
                 int newByte = Serial1.read(); // read in the first byte
                 buffer[1] = newByte;
                 Serial1.write(buffer, sizeOf(buffer));
                 }
               }
              }

            void loop(){
                   state1();
                   Serial1.flush();  //clear the serial port 
                   delay(100);
                }
                
Source Link
Loading