You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

58 lines
1.6 KiB
C++

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

#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:";
const int button1Pin = 4; //buttons constants
const int button2Pin = 3;
const int button3Pin = 2;
int button1State = 0; //buttons variables
int button2State = 0;
int button3State = 0;
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);
pinMode ( button1Pin && button2Pin && button3Pin, INPUT_PULLUP);
}
void loop() {
// put your main code here, to run repeatedly:
button1State = digitalRead(button1Pin); //read the buttons state
button2State = digitalRead(button2Pin);
button3State = digitalRead(button3Pin);
if (button1State == LOW && 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 (button2State == LOW && Serial.available() > 0) { //serial communication HEX
incomingByte = Serial.read();
TV.print (0, 0, neighbour);
delay (500);
TV.println (incomingByte, HEX);
}
else if (button3State == LOW && Serial.available() > 0) { //serial communcation BIN
incomingByte = Serial.read();
TV.print (0, 0, neighbour);
delay (500);
TV.println (incomingByte, BIN);
}
}