Mysterious arduino mega crash after trying to print a string with Wire.print()

So i’ve been trying all day to communicate to an arduino uno with my arduino mega via i2c,
but so far, i haven’t been able to send anything except numbers, that’s where the problem starts…

I want the arduino mega to send a string to the uno, wich i tried accomplishing with Wire.print().
only, when i try to call that function with my string as parameter, the arduino kind of crashes, saying, that it stops running the rest of the program. i checked this by looking at the serial monitor and not seeing the “no chrash here!” message.

I don’t know what the cause of the crash is, it could just be my board (arduino mega 2560 clone from geekcreit) or just a programming error.

my code is below.

thanks already,

#include <Wire.h>

String message = "hello";

void setup() {


void loop() {

  Serial.println("no crash here!");

Not even sure how your code compiles since there is no print() function in the Wire class (at least it isn’t listed here).

My suggestion is to use a for loop to send the string data out one char at a time using successive Wire.write() calls.

Thanks for the reply, and saving me from slowly finding out Wire doesnt have a print function, but things are getting worse: now, when i am trying to send one character using Wire.write('a') the same behaviour occurs: it just stops executing the rest of the program.
Does anybody know what could be wrong?

It is not a good idea to use the String (capital S) class on an Arduino as it can cause memory corruption in the small memory on an Arduino. Just use cstrings - char arrays terminated with 0.


Wire.beginTransmission( 8 ) will Begin a transmission to the I2C slave device with address 8

What do you have connected to your arduino and how ?
What code is returned by endTransmission?