Mysterious arduino mega crash after trying to print a string with Wire.print()
so i've been trying day communicate arduino uno arduino mega via i2c,
but far, haven't been able send except numbers, that's problem starts...
i want arduino mega send string uno, wich tried accomplishing wire.print().
only, when try call function string parameter, arduino kind of crashes, saying, stops running rest of program. checked looking @ serial monitor , not seeing "no chrash here!" message.
i don't know cause of crash is, board (arduino mega 2560 clone geekcreit) or programming error.
my code below.
thanks already,
inzywinki
but far, haven't been able send except numbers, that's problem starts...
i want arduino mega send string uno, wich tried accomplishing wire.print().
only, when try call function string parameter, arduino kind of crashes, saying, stops running rest of program. checked looking @ serial monitor , not seeing "no chrash here!" message.
i don't know cause of crash is, board (arduino mega 2560 clone geekcreit) or programming error.
my code below.
thanks already,
inzywinki
code: [select]
#include <wire.h>
string message = "hello";
void setup() {
serial.begin(9600);
wire.begin();
wire.begintransmission(8);
wire.print(message);
wire.endtransmission();
}
void loop() {
serial.println("no crash here!");
delay(1000);
}
not sure how code compiles since there no print() function in wire class (at least isn't listed here).
my suggestion use loop send string data out 1 char @ time using successive wire.write() calls.
my suggestion use loop send string data out 1 char @ time using successive wire.write() calls.
Arduino Forum > Using Arduino > Programming Questions > Mysterious arduino mega crash after trying to print a string with Wire.print()
arduino
Comments
Post a Comment