Июл 082016
 

 

2560-arduino-home-made

Вот решил Arduino собрать на ATmega2560, вот что получилось.

p.s. Плата переходник для подключения WG12864B

U8GLIB_KS0108_128 u8g(22,23,24,25,26,27,28,29,34,30,39,33,32,31);

// 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, cs1=14, cs2=15,di=17,rw=16,rst=31

Тест программка.

#include <openGLCD.h>

void setup()
{
  GLCD.Init();
  GLCD.SelectFont(System5x7);
  GLCD.ClearScreen();

  pinMode(A15, OUTPUT);
  pinMode(44, OUTPUT);
  digitalWrite(44, HIGH);    
  digitalWrite(A15,HIGH);
}

byte pos = 0;
byte r;
void loop()
{
  while(1) {
    GLCD.ClearScreen();

    for(byte x=0;x<11;x++) {
      r = random(1,63);
      if (pos==0) {
        Bar(pos,0,10,r);
      }
      else {
        Bar(pos+(x*2),0,10,r);
      }
      pos=pos+10;
    }
    delay(200);
    pos =0;
  }

}

void Bar(int x,int y, int w, int h) {
  GLCD.FillRect(x,63-h,w,h,BLACK);
}

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)

*