Test Version 3

parent 8e2f41da
{
"C_Cpp.errorSquiggles": "Disabled"
}
\ No newline at end of file
......@@ -8,15 +8,13 @@ uint8_t ADDR;
uint8_t last_ADDR;
int buttonState1 = 0;
int buttonState2 = 0;
int lastbuttonState1 = 0;
int lastbuttonState2 = 0;
int lastButtonState1 = 0;
int lastButtonState2 = 0;
uint8_t getData = 0;
uint8_t *data =0;
#define LED_PIN 13
#define ADDR3_PIN 11
#define ADDR2_PIN 10
......@@ -46,7 +44,7 @@ void asynch9_init(long BAUD) {
}
/*frame format 9 bits of data*/
UCSR0C |= (3<<UCSZ01);
UCSR0B |= (1<<UCSZ02)
UCSR0B |= (1<<UCSZ02);
}
......@@ -134,7 +132,7 @@ void loop() {
send_data(0);
last_ADDR = SLAVE1_ADDR;
}
} lastbuttonState1 = buttonState1;
} lastButtonState1 = buttonState1;
}else if(buttonState1 != lastButtonState1){
if(buttonState1 == HIGH){
if(last_ADDR & SLAVE1_ADDR){
......@@ -157,7 +155,7 @@ void loop() {
last_ADDR = SLAVE2_ADDR;
}
}
lastbuttonState2 = buttonState2;
lastButtonState2 = buttonState2;
}else if(buttonState2 != lastButtonState2){
if(buttonState2 == HIGH){
if(last_ADDR & SLAVE2_ADDR){
......@@ -173,7 +171,7 @@ void loop() {
//slaves
if(ADDR & SLAVE1_ADDR || ADDR & SLAVE2_ADDR){
digitalWrite(WREN_PIN,LOW); // Para que os transceivers (os slaves) possam receber
getData = get_data(&data);
getData = get_data(data);
if(getData == 1 && ADDR == *data){// se for o endereço
UCSR0A &= ~(1<<MPCM0); //para comecar a "ouvir" data framees
}else if(getData == 1 && ADDR != *data){
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment