Code: Select all
/*
disclamer: i am not resposible for breaking your axa remote 2.0 or your cat dying due to this code ;-)
axa remote 2.0 remote
arduino pro mini 5v (should also work with other arduinos)
arduino -- mcp2300
gnd -- gnd
rx -- rx
tx -- tx
open, close, stop buttons -- pushbuttons attached to pin 2/3/4 from +5V
10K resistor attached to pin 2/3/4 from ground
*/
int buttonOpenState = 0;
int buttonCloseState = 0;
int buttonStopState = 0;
#define BUTTON_OPEN 2
#define BUTTON_CLOSE 3
#define BUTTON_STOP 4
void setup() {
// initialize both serial ports:
Serial.begin(19200,SERIAL_8N1);
pinMode(BUTTON_OPEN,INPUT);
pinMode(BUTTON_CLOSE,INPUT);
pinMode(BUTTON_STOP, INPUT);
}
void loop() {
buttonOpenState = digitalRead(BUTTON_OPEN);
buttonCloseState = digitalRead(BUTTON_CLOSE);
buttonStopState = digitalRead(BUTTON_STOP);
if(buttonOpenState == HIGH){
open_axa(); }
if(buttonCloseState == HIGH){
close_axa(); }
if(buttonStopState == HIGH){
stop_axa(); }
}
void open_axa() {
Serial.print("O");
delay(20);
Serial.print("P");
delay(20);
Serial.print("E");
delay(20);
Serial.print("N");
delay(20);
Serial.println("\r");
delay(20);
}
void close_axa() {
Serial.print("C");
delay(20);
Serial.print("L");
delay(20);
Serial.print("O");
delay(20);
Serial.print("S");
delay(20);
Serial.print("E");
delay(20);
Serial.println("\r");
delay(20);
}
void stop_axa() {
Serial.print("S");
delay(20);
Serial.print("T");
delay(20);
Serial.print("O");
delay(20);
Serial.print("P");
delay(20);
Serial.println("\r");
delay(20);
}