0
Offline
Newbie
Karma: 0
Posts: 14
Arduino rocks
|
 |
« on: January 16, 2011, 04:44:35 pm » |
Hallo zusammen, mein erstes posting hier... :-)
Bin Anfänger mit Arduino und habe das DateTime Beispiel Sketch ausprobiert, tagelang rumprobiert, die Zeit lässt sich mit dem Processing Sketch nicht aktualisieren, auch über den Serial Monitor gehts nicht. Arduino UNO stürzt ab. Nun habe ich mal einen Test mit einem Win XP Rechner gemacht. Geht auch nicht... ABER NACH NEUEM PROGRAMMUPLOAD ÜBER XP: Läuft..! Auch auf dem MAC. Programm noch mal mit MAC geflasht: Selber Fehler. Ansonsten läuft es aber, auch keine Fehlermeldung beim upload. Was ist das??? Ich weiß nicht mehr weiter... :-/
Gruß Michael
|
|
|
|
|
Logged
|
|
|
|
|
BZ (I)
Offline
Brattain Member
Karma: 162
Posts: 15712
+39 349 2158303
|
 |
« Reply #1 on: January 16, 2011, 05:54:34 pm » |
Hast Du im IDE das richtige board eingestellt? Grüße Uwe
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Newbie
Karma: 0
Posts: 14
Arduino rocks
|
 |
« Reply #2 on: January 17, 2011, 12:33:57 pm » |
Ja, richtiges Board, richtige schnittstelle...
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Newbie
Karma: 0
Posts: 19
|
 |
« Reply #3 on: January 17, 2011, 12:35:39 pm » |
Sag bitte nicht MAC wenn du Mac(intosh) meinst, das ist ein riesen unterschied und führt zur Verwirrung.
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
God Member
Karma: 1
Posts: 659
Arduino sucks
|
 |
« Reply #4 on: January 17, 2011, 12:37:18 pm » |
Sag bitte nicht MAC wenn du Mac(intosh) meinst, das ist ein riesen unterschied und führt zur Verwirrung. Wenn man sich richtig blöd stellt, führt auch dein Name zu Verwirrung, weil man sich fragt ob du einen Wischmopp meinst. Sicher wäre OSX besser, aber wegen sowas hier reinzuposten...
|
|
|
|
« Last Edit: January 17, 2011, 12:37:54 pm by saw0 »
|
Logged
|
|
|
|
|
BZ (I)
Offline
Brattain Member
Karma: 162
Posts: 15712
+39 349 2158303
|
 |
« Reply #5 on: January 17, 2011, 05:35:47 pm » |
Ich glaube manchemal können Diskussionsbeiträge gespart werden weil sie nichts für die Diskussion bringen. Dein letzter Beitrag, apogee gehört zu dieser Kategorie.  Grüße Uwe
|
|
|
|
|
Logged
|
|
|
|
|
BZ (I)
Offline
Brattain Member
Karma: 162
Posts: 15712
+39 349 2158303
|
 |
« Reply #6 on: January 17, 2011, 05:39:41 pm » |
hallo buddhafragt Ich tippe da mehr auf eine Programmfehler den Du in der MÄC - Version des Sketches hast, aber nicht in der WinVersion des Sketches. Sind die beiden Sketch-Versionen wirklich 100% gleich? Gleiche IDE-Version und Bibliotheken? Schick uns mal bitte den MÄC - Sketch.  Grüße Uwe
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Newbie
Karma: 0
Posts: 14
Arduino rocks
|
 |
« Reply #7 on: January 19, 2011, 05:40:46 pm » |
Ja, mache ich doch gern, aber ist wirklich nur die unveränderte Demo-Datei.... kann man hier eigentlich auch eine Datei anhängen, oder geht das immer nur über copy/past????
// DateTime.pde // example sketch for the DateTime library
#include <DateTime.h> #include <DateTimeStrings.h>
#define TIME_MSG_LEN 11 // time sync to PC is HEADER followed by unix time_t as ten ascii digits #define TIME_HEADER 255 // Header tag for serial time sync message
void setup(){ Serial.begin(19200); pinMode(13,OUTPUT); // we flash the LED each second }
void loop(){ unsigned long prevtime; if( getPCtime()) { // try to get time sync from pc Serial.print("Clock synced at: "); Serial.println(DateTime.now(),DEC); } if(DateTime.available()) { // update clocks if time has been synced digitalWrite(13,LOW); // first flash the LED prevtime = DateTime.now(); while( prevtime == DateTime.now() ) // wait for the second to rollover ; DateTime.available(); //refresh the Date and time properties digitalClockDisplay( ); // update digital clock
// send our time to any app at the other end of the serial port Serial.print( TIME_HEADER,BYTE); // this is the header for the current time Serial.println(DateTime.now()); digitalWrite(13,HIGH); } delay(100); }
boolean getPCtime() { // if time sync available from serial port, update time and return true while(Serial.available() >= TIME_MSG_LEN ){ // time message consists of a header and ten ascii digits if( Serial.read() == TIME_HEADER ) { time_t pctime = 0; for(int i=0; i < TIME_MSG_LEN -1; i++){ char c= Serial.read(); if( c >= '0' && c <= '9'){ pctime = (10 * pctime) + (c - '0') ; // convert digits to a number } } DateTime.sync(pctime); // Sync Arduino clock to the time received on the serial port return true; // return true if time message received on the serial port } } return false; //if no message return false }
void digitalClockDisplay(){ // digital clock display of current date and time Serial.print(DateTime.Hour,DEC); printDigits(DateTime.Minute); printDigits(DateTime.Second); Serial.print(" "); Serial.print(DateTimeStrings.dayStr(DateTime.DayofWeek)); Serial.print(" "); Serial.print(DateTimeStrings.monthStr(DateTime.Month)); Serial.print(" "); Serial.println(DateTime.Day,DEC); }
void printDigits(byte digits){ // utility function for digital clock display: prints preceding colon and leading 0 Serial.print(":"); if(digits < 10) Serial.print('0'); Serial.print(digits,DEC); }
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
God Member
Karma: 1
Posts: 659
Arduino sucks
|
 |
« Reply #8 on: January 20, 2011, 02:25:16 am » |
kann man hier eigentlich auch eine Datei anhängen, oder geht das immer nur über copy/past???? Man kann sie zumindest so formatieren, dass man sie lesen kann. IDE - Rechtsklick - Copy for Forum const int ledPin = 13; // the pin that the LED is attached toint incomingByte; // a variable to read incoming serial data intovoid setup() { // initialize serial communication: Serial. begin(9600); // initialize the LED pin as an output: pinMode(ledPin, OUTPUT); } void loop() { // see if there's incoming serial data: if ( Serial. available() > 0) { // read the oldest byte in the serial buffer: incomingByte = Serial. read(); // if it's a capital H (ASCII 72), turn on the LED: if (incomingByte == 'H') { digitalWrite(ledPin, HIGH); } // if it's an L (ASCII 76) turn off the LED: if (incomingByte == 'L') { digitalWrite(ledPin, LOW); } } }
|
|
|
|
« Last Edit: January 20, 2011, 02:26:09 am by saw0 »
|
Logged
|
|
|
|
|
|