Welcome! Log In Create A New Profile

Advanced

example "hello world" with reprap

Posted by ag.chumpitazr 
example "hello world" with reprap
September 24, 2016 12:38PM
First... sorry for my english...
I'm pretty new to Arduino, and i want to print what i want in the screen...
I am using Arduino mega, full graphic smart controller [ [www.google.es] ], and ramps 1.4; i found this code "hello world" with u8lib but it isn't work -> "avrdude: stk500v2_ReceiveMessage(): timeout" :

#include "U8glib.h"

U8GLIB_ST7920_128X64_4X u8g(23, 17, 16); // SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17


void draw(void) {
// graphic commands to redraw the complete screen should be placed here
u8g.setFont(u8g_font_unifont);
//u8g.setFont(u8g_font_osb21);
u8g.drawStr( 0, 22, "Hello World!");
}

void setup(void) {
// flip screen, if required
// u8g.setRot180();

// set SPI backup if required
//u8g.setHardwareBackup(u8g_backup_avr_spi);

// assign default color value
if ( u8g.getMode() == U8G_MODE_R3G3B2 ) {
u8g.setColorIndex(255); // white
}
else if ( u8g.getMode() == U8G_MODE_GRAY2BIT ) {
u8g.setColorIndex(3); // max intensity
}
else if ( u8g.getMode() == U8G_MODE_BW ) {
u8g.setColorIndex(1); // pixel on
}
else if ( u8g.getMode() == U8G_MODE_HICOLOR ) {
u8g.setHiColorByRGB(255,255,255);
}
}

void loop(void) {
// picture loop
u8g.firstPage();
do {
draw();
} while( u8g.nextPage() );

// rebuild the picture after some delay
delay(50);
}

someone can see the problem?
Re: example "hello world" with reprap
September 24, 2016 09:15PM
stk500v2_ReceiveMessage(): timeout is a communications issue talking to the controller. Its has nothing to do with your code.

Check you board type is correct. also make sure you can upload the blink eg first to check your board is talking correctly

Edited 1 time(s). Last edit at 09/25/2016 07:37AM by Dust.
Sorry, only registered users may post in this forum.

Click here to login