#define DATA 3
volatile long syncTime;
void setup() {
Serial.begin(115200);
tone(DATA,1900);
delay(100);
tone(DATA,1500);
delay(100);
tone(DATA,1900);
delay(100);
tone(DATA,1500);
delay(100);
tone(DATA,2300);
delay(100);
tone(DATA,1500);
delay(100);
tone(DATA,2300);
delay(100);
tone(DATA,1500);
delay(100);
//-- VIS CODE --
//VIS CODE for Scottie1 is B0111100 (DECIMAL 60)
tone(DATA,1900);
delay(300);
tone(DATA,1200); //BREAK
delay(10);
tone(DATA,1900);
delay(300);
tone(DATA,1200); //START BIT
delay(30);
tone(DATA,1300); //BIT 0 (LSB FIRST)
delay(30);
tone(DATA,1300); //BIT 0 (LSB FIRST)
delay(30);
tone(DATA,1100); //BIT 1
delay(30);
tone(DATA,1100); //BIT 1
delay(30);
tone(DATA,1100); //BIT 1
delay(30);
tone(DATA,1100); //BIT 1
delay(30);
tone(DATA,1300); //BIT 6
delay(30);
tone(DATA,1300); //EVEN PARITY
delay(30);
tone(DATA,1200); //STOP BIT
delay(30);
//-- VIS DONE --
// put your main code here, to run repeatedly:
tone(DATA,1200);
delay(9);
//256 strok po 138ms
for (uint16_t x = 0; x < 256; x++){
// Serial.println(x,DEC);
// Separator pulse
tone(DATA,1500);
syncTime = micros();
// Serial.println(syncTime);
while(micros() - syncTime < 1500 - 6){} // Separator pulse
// syncTime = micros();
// Serial.println(syncTime);
// Serial.println("Green");
// Green line
tone(DATA,1500 + 3.1372549 * 128);
syncTime = micros();
// Serial.println(syncTime);
while(micros() - syncTime < 138240 - 6){} // Separator pulse
// syncTime = micros();
// Serial.println(syncTime);
// Serial.println("=====");
// Separator Pulse
tone(DATA,1500);
syncTime = micros();
// Serial.println(syncTime);
while(micros() - syncTime < 1500 - 6){} // Separator pulse
// syncTime = micros();
// Serial.println(syncTime);
// Serial.println("Blue");
// Blue Scan
tone(DATA,1500 + 3.1372549 * 255);
syncTime = micros();
// Serial.println(syncTime);
while(micros() - syncTime < 138240 - 6){} // Separator pulse
// syncTime = micros();
// Serial.println(syncTime);
// Serial.println("sync");
// Sync Pulse
tone(DATA,1200);
delay(9);
// Serial.println("=====");
// Sync porch
tone(DATA,1500);
syncTime = micros();
// Serial.println(syncTime);
while(micros() - syncTime < 1500 - 6){} // Separator pulse
// syncTime = micros();
// Serial.println(syncTime);
// Serial.println("Red");
// Red Scan
tone(DATA,1500 + 3.1372549 * 128);
syncTime = micros();
// Serial.println(syncTime);
while(micros() - syncTime < 138240 - 6){} // Separator pulse
// syncTime = micros();
// Serial.println(syncTime);
}
//FSKid
tone(DATA,1500);
delay(300);
tone(DATA,2100);
delay(100);
tone(DATA,1900);
delay(22);
tone(DATA,2100); //BIT 0 * 0x2A 010101
delay(22);
tone(DATA,1900); //BIT 1
delay(22);
tone(DATA,2100); //BIT 2
delay(22);
tone(DATA,1900); //BIT 3
delay(22);
tone(DATA,2100); //BIT 4
delay(22);
tone(DATA,1900); //BIT 5
delay(22);
tone(DATA,2100); //BIT 0 R 0x52-0x20=0x32 010011
delay(22);
tone(DATA,1900); //BIT 1
delay(22);
tone(DATA,2100); //BIT 2
delay(22);
tone(DATA,2100); //BIT 3
delay(22);
tone(DATA,1900); //BIT 4
delay(22);
tone(DATA,1900); //BIT 5
delay(22);
tone(DATA,1900); //BIT 0 3 0x33-0х20=0х13 110010
delay(22);
tone(DATA,1900); //BIT 1
delay(22);
tone(DATA,2100); //BIT 2
delay(22);
tone(DATA,2100); //BIT 3
delay(22);
tone(DATA,1900); //BIT 4
delay(22);
tone(DATA,2100); //BIT 5
delay(22);
tone(DATA,1900); //BIT 0 К 0x4B-0x20=0x2B 110101
delay(22);
tone(DATA,1900); //BIT 1
delay(22);
tone(DATA,2100); //BIT 2
delay(22);
tone(DATA,1900); //BIT 3
delay(22);
tone(DATA,2100); //BIT 4
delay(22);
tone(DATA,1900); //BIT 5
delay(22);
tone(DATA,1900); //BIT 0 E 0x45-0x20=0x25 101001
delay(22);
tone(DATA,2100); //BIT 1
delay(22);
tone(DATA,1900); //BIT 2
delay(22);
tone(DATA,2100); //BIT 3
delay(22);
tone(DATA,2100); //BIT 4
delay(22);
tone(DATA,1900); //BIT 5
delay(22);
tone(DATA,1900); //BIT 0 E 0x45-0x20=0x25 101001
delay(22);
tone(DATA,2100); //BIT 1
delay(22);
tone(DATA,1900); //BIT 2
delay(22);
tone(DATA,2100); //BIT 3
delay(22);
tone(DATA,2100); //BIT 4
delay(22);
tone(DATA,1900); //BIT 5
delay(22);
tone(DATA,1900); //BIT 0 SOH 0x01 100000
delay(22);
tone(DATA,2100); //BIT 1
delay(22);
tone(DATA,2100); //BIT 2
delay(22);
tone(DATA,2100); //BIT 3
delay(22);
tone(DATA,2100); //BIT 4
delay(22);
tone(DATA,2100); //BIT 5
delay(22);
tone(DATA,2100); //BIT 0 XOR 0x0A 0101(00)?????
delay(22);
tone(DATA,1900); //BIT 1
delay(22);
tone(DATA,2100); //BIT 2
delay(22);
tone(DATA,1900); //BIT 3
delay(22);
tone(DATA,2100); //BIT 4
delay(22);
tone(DATA,2100); //BIT 5
delay(22);
//-- FSKid DONE --
noTone(3);
Serial.println("STOP");
}
void loop() {
}