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.

100 lines
2.4 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>
#include <avr/pgmspace.h>
#include <TVout.h>
#include "mouthclosed.h"
#include "mouthopen.h"
#include "top.h"
int knob1;
int knob2;
int knob3;
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
char HELLO []= "hello!";
char H []= "01101000";
char E []= "01100101";
char L []= "01101100";
char O []= "01101111";
char IPA []= "ˈləʊ";
char third []= "{V}isModal_Voice";
char fourth []= "{F}isFalsetto";
char first []= "{W}isWhisper";
char second []= "{C}isCreak";
char neighbour [] = "neighbour[ˈneɪbər] says:";
void setup() {
Serial.begin (9600);
TV.select_font(font6x8);
TV.begin(PAL,120,96);
pinMode ( button1Pin && button2Pin && button3Pin, INPUT_PULLUP);
// put your setup code here, to run once:
}
void loop() {
// put your main code here, to run repeatedly:
button1State = digitalRead(button1Pin); //read the buttons state
button2State = digitalRead(button2Pin);
button3State = digitalRead(button3Pin);
knob1 = analogRead(2);
knob2 = analogRead(1);
TV.bitmap (0,0,top);
TV.bitmap (0,55,mouthclosed);
TV.delay (500);
TV.bitmap (0,55,mouthopen);
TV.delay (500);
Serial.println ("TVOUT");
Serial.println(knob2);
if (button1State == HIGH) {
Serial.print ("button1");
TV.clear_screen ();
//TV.draw_rect (70,10,45,80,WHITE,WHITE);
TV.select_font(font8x8ext);
//TV.fill (INVERT);
TV.print(70,20,HELLO);
TV.println(70,30,HELLO);
TV.println(70,40,HELLO);
TV.println(70,50,HELLO);
TV.println(70,60,HELLO);
TV.println(70,70,HELLO);
}
/*if (button1State == LOW) { //when the button is not pressed the sentence disappears
TV.clear_screen ();
}*/
if (button2State == HIGH) {
Serial.print ("button2");
TV.clear_screen ();
TV.select_font(font4x6);
TV.print(70,70,HELLO);
TV.println(70,60,IPA);
//delay (50);
}
if (button3State == HIGH) {
Serial.print ("button3");
TV.clear_screen ();
//TV.fill(INVERT);
TV.select_font(font6x8);
TV.print(70,20,H);
TV.print(70,30,E);
TV.print(70,40,L);
TV.print(70,50,L);
TV.print(70,60,O);
//delay (50);
}
}