I am trying to connect two Atmel 88 chips for communication and transfer of 8 digital I/0 and 6 analogue signals. I have already made the two boards talk via RS232 and press one switch on the master and the slave(reciever) atmel88 lights the LED.
However I do not know how to send 8 I/O pins and 6 Analogue signals. Can someone help.
/*
- Program for check analog and digital input for joystick
Swap Jumper Number 9 Because we need to use this pin for input* - Function : Read Analog and Digital to Display to RS232
*/
#define ledPin 13
void setup() //Setup Function
{
Serial.begin(19200); //Initial RS232 Baud = 19200
Serial.println("Please enter text");
pinMode(ledPin, OUTPUT);
digitalWrite(ledPin,LOW);
}
void loop() //Main Function
{
if (Serial.available() > 0)
{
int var = Serial.read();
if (var ==0x31)
{
digitalWrite(ledPin,HIGH);
}else if (var !=0x31)
{
digitalWrite(ledPin,LOW);
}
}
}
/*
- Program for check analog and digital input for joystick
Swap Jumper Number 9 Because we need to use this pin for input* - Function : Read Analog and Digital to Display to RS232
*/
#define PowPin 8
void setup() //Setup Function
{
Serial.begin(19200); //Initial RS232 Baud = 19200
pinMode(PowPin, INPUT);
Serial.print(0);
}
void loop() //Main Function
{
if(digitalRead(PowPin) == HIGH)
{
Serial.print("1");
}else if(digitalRead(PowPin) == LOW)
{
Serial.print("0");
}
}
The program her works OK.
Can anyone help,
Take care.