Problem mit SPI


hallo,
ich möchte ein nokia 5110 display und eine sd karte über ein mega board betreiben.

leider zeigt mir das display nichts an.

code: [select]
#include <sd.h>
#include <lcd5110_basic.h>

const int chipselect = 53;
float datalog = 0;
float datalogalt = 0;
int value = 10;

lcd5110 myglcd(52,51,49,48,46);
extern uint8_t smallfont[];
extern uint8_t mediumnumbers[];
extern uint8_t bignumbers[];

void setup(){
  serial.begin(9600); 
  serial.print("initializing sd card...");
  // make sure default chip select pin set to
  // output, if don't use it:
  pinmode(53, output); 
  // see if card present , can initialized:
  if (!sd.begin(chipselect)) {
    serial.println("card failed, or not present");
    // don't more:
    return;
  }
  serial.println("card initialized."); 
   myglcd.initlcd();
}

void loop(){ 
  datalog = millis();   
   if((datalog - datalogalt) >=6000){   
   file datafile = sd.open("test.txt", file_write); 
  if (datafile) {     
    datafile.println(value);
    datafile.close();
    // print serial port too:
    serial.println(value);   
    datalogalt = datalog;
    value --;
  }
     else {
    serial.println("error opening test.txt");
  }
   }
   myglcd.setfont(smallfont);
    myglcd.inverttext(true);
    myglcd.print("start", left,0);
    serial.println("hallo");

}

siehst du denn eine sd fehlermeldung?
quote
code: [select]

void setup()
{
//...
  serial.println("card initialized.");
   myglcd.initlcd();
}

warum auch immer du das programmiert hast: das display wird nur initialisiert, wenn die sd initialisierung geklappt hat.

ausserdem würde ich für das display nicht die spi pins (50 .. 53) verwenden, weil das nokia5110 kein echtes spi macht.
auf dem mega hast du doch sicher genug pins frei.


Arduino Forum > International > Deutsch (Moderator: uwefed) > Problem mit SPI


arduino

Comments

Popular posts from this blog

Authentication error while password reset - Raspberry Pi Forums

opencv3, tbb and rasp pi 2 - Raspberry Pi Forums

small ethernet problem - Raspberry Pi Forums