simonprein
20.03.2014, 21:50
hi
ich habe volgendes programm und folgende fehlermeldung . wo liegt das problem? die variablen sind doch initialisiert
#include <TVout.h>
#include <fontALL.h>
#include <Wire.h>
TVout TV;
void setup()
{
TV.begin(_PAL, 128, 96);
TV.clear_screen();
TV.select_font(font6x8);
Wire.begin(4); // join i2c bus with address #4
Wire.onReceive(receiveEvent); // register event
Serial.begin(9600); // start serial for output
int control;
int a;
}
void loop()
{
TV.clear_screen();
TV.print(10,10, a );
int b == a ;
if ( b == a )
{delay (100);}
}
// function that executes whenever data is received from master
// this function is registered as an event, see setup()
void receiveEvent(int howMany)
{
while(1 < Wire.available()) // loop through all but the last
{
char c = Wire.read(); // receive byte as a character
Serial.print(c); // print the character
}
int x = Wire.read(); // receive byte as an integer
Serial.println(x); // print the integer
a = x;
}
slave_receiver.ino: In function 'void loop()':
slave_receiver:23: error: 'a' was not declared in this scope
slave_receiver:24: error: expected initializer before '==' token
slave_receiver:25: error: 'b' was not declared in this scope
slave_receiver.ino: In function 'void receiveEvent(int)':
slave_receiver:40: error: 'a' was not declared in this scope
ich habe volgendes programm und folgende fehlermeldung . wo liegt das problem? die variablen sind doch initialisiert
#include <TVout.h>
#include <fontALL.h>
#include <Wire.h>
TVout TV;
void setup()
{
TV.begin(_PAL, 128, 96);
TV.clear_screen();
TV.select_font(font6x8);
Wire.begin(4); // join i2c bus with address #4
Wire.onReceive(receiveEvent); // register event
Serial.begin(9600); // start serial for output
int control;
int a;
}
void loop()
{
TV.clear_screen();
TV.print(10,10, a );
int b == a ;
if ( b == a )
{delay (100);}
}
// function that executes whenever data is received from master
// this function is registered as an event, see setup()
void receiveEvent(int howMany)
{
while(1 < Wire.available()) // loop through all but the last
{
char c = Wire.read(); // receive byte as a character
Serial.print(c); // print the character
}
int x = Wire.read(); // receive byte as an integer
Serial.println(x); // print the integer
a = x;
}
slave_receiver.ino: In function 'void loop()':
slave_receiver:23: error: 'a' was not declared in this scope
slave_receiver:24: error: expected initializer before '==' token
slave_receiver:25: error: 'b' was not declared in this scope
slave_receiver.ino: In function 'void receiveEvent(int)':
slave_receiver:40: error: 'a' was not declared in this scope