|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include <fontALL.h> //libraries fro the TV OUT mode
|
|
|
|
|
#include <TVout.h>
|
|
|
|
|
|
|
|
|
|
//button1=english,button2=HEX,button3=BIN:the buttons control the serial communcation with the other module
|
|
|
|
|
const char neighbour [] = "neighbour[ˈneɪbər] says:";
|
|
|
|
|
|
|
|
|
|
int knob1;
|
|
|
|
|
int knob2;
|
|
|
|
|
|
|
|
|
|
int incomingByte = 0; //for serial communication
|
|
|
|
|
|
|
|
|
|
TVout TV; //for the TVOUT mode
|
|
|
|
|
|
|
|
|
|
void setup() {
|
|
|
|
|
// put your setup code here, to run once:
|
|
|
|
|
Serial.begin (9600);
|
|
|
|
|
Serial.println(TV.vres());
|
|
|
|
|
Serial.println(TV.hres());
|
|
|
|
|
TV.begin(PAL,120,96);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void loop() {
|
|
|
|
|
// put your main code here, to run repeatedly:
|
|
|
|
|
knob1 = analogRead(1);
|
|
|
|
|
knob2 = analogRead(2);
|
|
|
|
|
|
|
|
|
|
if (knob1>0 && knob1<500 && Serial.available() > 0) { //serial communcation english
|
|
|
|
|
incomingByte = Serial.read();//read the incoming byte
|
|
|
|
|
TV.print (0, 0, neighbour);
|
|
|
|
|
delay (500);
|
|
|
|
|
TV.println (incomingByte);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
else if (knob1>500 && knob1<1023 && Serial.available() > 0) { //serial communication HEX
|
|
|
|
|
incomingByte = Serial.read();
|
|
|
|
|
TV.print (0, 0, neighbour);
|
|
|
|
|
delay (500);
|
|
|
|
|
TV.println (incomingByte, HEX);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
else if (knob2>0 && knob2<500 && Serial.available() > 0) { //serial communcation english
|
|
|
|
|
incomingByte = Serial.read();
|
|
|
|
|
TV.print (0, 0, neighbour);
|
|
|
|
|
delay (500);
|
|
|
|
|
TV.println (incomingByte);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
else if (knob2>500 && knob2<1023 && Serial.available() > 0) { //serial communication BIN
|
|
|
|
|
incomingByte = Serial.read();
|
|
|
|
|
TV.print (0, 0, neighbour);
|
|
|
|
|
delay (500);
|
|
|
|
|
TV.println (incomingByte, BIN);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|