20-01-2017, 01:28
20-01-2017, 01:33
Spoko,wiecej mi nie trzeba. Wgraj skecz hello world jeszcze raz na adres 0x27 w takim wypadku.Najlepiej jak wpiszesz tamte polecenie deklaracji wyswietlacza bo napewno dziala na taki konwerter jak masz. W setup dopisujesz jeszcze lcd.backlight(); i powinno byc spoko. Jak bedzie migac wyswietlacz to odpal monitor szeregowy. Czasem to pomaga na resety. Nie bede tlumaczyl dlaczego bo sam srednio wiem. Jesli zadziala to pomyslimy co dalej z tym fantem zrobić. Teoretycznie wiem,ale w praktyce otwarty port za bardzo mi nie przeszkadza w testowaniu.
20-01-2017, 01:48
to jest ten kod po dopisaniu nie da się wgrać
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#define BACKLIGHT_PIN 13
LiquidCrystal_I2C lcd(0x27); // Set the LCD I2C address
//LiquidCrystal_I2C lcd(0x27, BACKLIGHT_PIN, POSITIVE); // Set the LCD I2C address
// Creat a set of new characters
const uint8_t charBitmap[][8] = {
{ 0xc, 0x12, 0x12, 0xc, 0, 0, 0, 0 },
{ 0x6, 0x9, 0x9, 0x6, 0, 0, 0, 0 },
{ 0x0, 0x6, 0x9, 0x9, 0x6, 0, 0, 0x0 },
{ 0x0, 0xc, 0x12, 0x12, 0xc, 0, 0, 0x0 },
{ 0x0, 0x0, 0xc, 0x12, 0x12, 0xc, 0, 0x0 },
{ 0x0, 0x0, 0x6, 0x9, 0x9, 0x6, 0, 0x0 },
{ 0x0, 0x0, 0x0, 0x6, 0x9, 0x9, 0x6, 0x0 },
{ 0x0, 0x0, 0x0, 0xc, 0x12, 0x12, 0xc, 0x0 }
};
void setup()
{
int charBitmapSize = (sizeof(charBitmap ) / sizeof (charBitmap[0]));
// Switch on the backlight
pinMode ( BACKLIGHT_PIN, OUTPUT );
digitalWrite ( BACKLIGHT_PIN, HIGH );
lcd.begin(16,2); // initialize the lcd
for ( int i = 0; i < charBitmapSize; i++ )
{
lcd.createChar ( i, (uint8_t *)charBitmap[i] );
}
lcd.home (); // go home
lcd.print("Hello, ARDUINO ");
lcd.setCursor ( 0, 1 ); // go to the next line
lcd.print (" FORUM - fm ");
delay ( 1000 );
}
void loop()
{
lcd.home ();
// Do a little animation by writing to the same location
for ( int i = 0; i < 2; i++ )
{
for ( int j = 0; j < 16; j++ )
{
lcd.print (char(random(7)));
}
lcd.setCursor ( 0, 1 );
}
delay (200);
}
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#define BACKLIGHT_PIN 13
LiquidCrystal_I2C lcd(0x27); // Set the LCD I2C address
//LiquidCrystal_I2C lcd(0x27, BACKLIGHT_PIN, POSITIVE); // Set the LCD I2C address
// Creat a set of new characters
const uint8_t charBitmap[][8] = {
{ 0xc, 0x12, 0x12, 0xc, 0, 0, 0, 0 },
{ 0x6, 0x9, 0x9, 0x6, 0, 0, 0, 0 },
{ 0x0, 0x6, 0x9, 0x9, 0x6, 0, 0, 0x0 },
{ 0x0, 0xc, 0x12, 0x12, 0xc, 0, 0, 0x0 },
{ 0x0, 0x0, 0xc, 0x12, 0x12, 0xc, 0, 0x0 },
{ 0x0, 0x0, 0x6, 0x9, 0x9, 0x6, 0, 0x0 },
{ 0x0, 0x0, 0x0, 0x6, 0x9, 0x9, 0x6, 0x0 },
{ 0x0, 0x0, 0x0, 0xc, 0x12, 0x12, 0xc, 0x0 }
};
void setup()
{
int charBitmapSize = (sizeof(charBitmap ) / sizeof (charBitmap[0]));
// Switch on the backlight
pinMode ( BACKLIGHT_PIN, OUTPUT );
digitalWrite ( BACKLIGHT_PIN, HIGH );
lcd.begin(16,2); // initialize the lcd
for ( int i = 0; i < charBitmapSize; i++ )
{
lcd.createChar ( i, (uint8_t *)charBitmap[i] );
}
lcd.home (); // go home
lcd.print("Hello, ARDUINO ");
lcd.setCursor ( 0, 1 ); // go to the next line
lcd.print (" FORUM - fm ");
delay ( 1000 );
}
void loop()
{
lcd.home ();
// Do a little animation by writing to the same location
for ( int i = 0; i < 2; i++ )
{
for ( int j = 0; j < 16; j++ )
{
lcd.print (char(random(7)));
}
lcd.setCursor ( 0, 1 );
}
delay (200);
}
20-01-2017, 03:44
Sprawdź ten:
Kod:
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE); // Ustawienie adresu ukladu na 0x27
void setup()
{
lcd.begin(16,2); // initialize the lcd
lcd.backlight();
lcd.home (); // go home
lcd.print("Hello, ARDUINO ");
lcd.setCursor ( 0, 1 ); // go to the next line
lcd.print (" FORUM - fm ");
delay ( 1000 );
}
void loop()
{
}
21-01-2017, 01:29
Wgrywa się jest ok ale zegara nadal nie mogę wgrać
23-01-2017, 13:00
Może po prostu coś jest źle w kodzie zegara.Najpierw wgraj sam przykład zegara i zobacz czy działa. Jeśli zadziała to zmodyfikuj swój kod.
23-01-2017, 15:43
Możesz zerknąć na ten kod
#include <DS1302RTC.h>
#include <Time.h>
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#define BACKLIGHT_PIN 3
LiquidCrystal_I2C lcd(0x27,2,1,0,4,5,6,7,3,POSITIVE);
const char *monthName[12] = {
"Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
};
void setup() {
lcd.begin(16, 2);
lcd.setBacklightPin(BACKLIGHT_PIN,POSITIVE);
lcd.setBacklight(HIGH);
}
void loop() {
tmElements_t tm;
if (RTC.read) {
lcd.setCursor (0, 0);
LCDprint2digits(tm.Hour);
lcd.print(':');
LCDprint2digits(tm.Minute);
lcd.print(':');
LCDprint2digits(tm.Second);
lcd.setCursor (0, 1);
lcd.print(tm.Day);
lcd.print('/');
lcd.print(monthName[tm.Month-1]);
lcd.print('/');
lcd.print(tmYearToCalendar(tm.Year));
} else {
if (RTC.chipPresent()) {
lcd.println("DS1302 stoi. Uruchom Zegar");
}
else {
lcd.println("DS1302 blad oczczytu!");
lcd.println("sprawdz polaczenie");
}
delay(9000);
}
delay(1000);
}
//void print2digits(int number) {
// if (number >= 0 && number < 10) {
// Serial.write('0');
// }
// Serial.print(number);
//}
void LCDprint2digits(int number) {
if (number >= 0 && number < 10) {
lcd.write('0');
}
lcd.print(number);
}
#include <DS1302RTC.h>
#include <Time.h>
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#define BACKLIGHT_PIN 3
LiquidCrystal_I2C lcd(0x27,2,1,0,4,5,6,7,3,POSITIVE);
const char *monthName[12] = {
"Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
};
void setup() {
lcd.begin(16, 2);
lcd.setBacklightPin(BACKLIGHT_PIN,POSITIVE);
lcd.setBacklight(HIGH);
}
void loop() {
tmElements_t tm;
if (RTC.read) {
lcd.setCursor (0, 0);
LCDprint2digits(tm.Hour);
lcd.print(':');
LCDprint2digits(tm.Minute);
lcd.print(':');
LCDprint2digits(tm.Second);
lcd.setCursor (0, 1);
lcd.print(tm.Day);
lcd.print('/');
lcd.print(monthName[tm.Month-1]);
lcd.print('/');
lcd.print(tmYearToCalendar(tm.Year));
} else {
if (RTC.chipPresent()) {
lcd.println("DS1302 stoi. Uruchom Zegar");
}
else {
lcd.println("DS1302 blad oczczytu!");
lcd.println("sprawdz polaczenie");
}
delay(9000);
}
delay(1000);
}
//void print2digits(int number) {
// if (number >= 0 && number < 10) {
// Serial.write('0');
// }
// Serial.print(number);
//}
void LCDprint2digits(int number) {
if (number >= 0 && number < 10) {
lcd.write('0');
}
lcd.print(number);
}
23-01-2017, 15:44
This report would have more information with
"Show verbose output during compilation"
enabled in File > Preferences.
Arduino: 1.0.6 (Windows 7), Board: "Arduino Uno"
In file included from RTC_Zegar.ino:1:
C:\Users\DANIEL\Documents\Arduino\libraries\DS1302RTC/DS1302RTC.h:95: error: 'time_t' does not name a type
C:\Users\DANIEL\Documents\Arduino\libraries\DS1302RTC/DS1302RTC.h:96: error: 'time_t' has not been declared
C:\Users\DANIEL\Documents\Arduino\libraries\DS1302RTC/DS1302RTC.h:97: error: 'tmElements_t' has not been declared
C:\Users\DANIEL\Documents\Arduino\libraries\DS1302RTC/DS1302RTC.h:98: error: 'tmElements_t' has not been declared
RTC_Zegar.ino: In function 'void loop()':
RTC_Zegar:22: error: 'tmElements_t' was not declared in this scope
RTC_Zegar:22: error: expected `;' before 'tm'
RTC_Zegar:24: error: 'RTC' was not declared in this scope
RTC_Zegar:24: error: 'tm' was not declared in this scope
RTC_Zegar:37: error: 'tmYearToCalendar' was not declared in this scope
"Show verbose output during compilation"
enabled in File > Preferences.
Arduino: 1.0.6 (Windows 7), Board: "Arduino Uno"
In file included from RTC_Zegar.ino:1:
C:\Users\DANIEL\Documents\Arduino\libraries\DS1302RTC/DS1302RTC.h:95: error: 'time_t' does not name a type
C:\Users\DANIEL\Documents\Arduino\libraries\DS1302RTC/DS1302RTC.h:96: error: 'time_t' has not been declared
C:\Users\DANIEL\Documents\Arduino\libraries\DS1302RTC/DS1302RTC.h:97: error: 'tmElements_t' has not been declared
C:\Users\DANIEL\Documents\Arduino\libraries\DS1302RTC/DS1302RTC.h:98: error: 'tmElements_t' has not been declared
RTC_Zegar.ino: In function 'void loop()':
RTC_Zegar:22: error: 'tmElements_t' was not declared in this scope
RTC_Zegar:22: error: expected `;' before 'tm'
RTC_Zegar:24: error: 'RTC' was not declared in this scope
RTC_Zegar:24: error: 'tm' was not declared in this scope
RTC_Zegar:37: error: 'tmYearToCalendar' was not declared in this scope
23-01-2017, 16:02
masz bardzo jasne komunikaty... pokaz kod
23-01-2017, 17:30
Cytat:#include <DS1302RTC.h>
#include <Time.h>
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#define BACKLIGHT_PIN 3
LiquidCrystal_I2C lcd(0x27,2,1,0,4,5,6,7,3,POSITIVE);
const char *monthName[12] = {
"Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
};
void setup() {
lcd.begin(16, 2);
lcd.setBacklightPin(BACKLIGHT_PIN,POSITIVE);
lcd.setBacklight(HIGH);
}
void loop() {
tmElements_t tm;
if (RTC.read) {
lcd.setCursor (0, 0);
LCDprint2digits(tm.Hour);
lcd.print(':');
LCDprint2digits(tm.Minute);
lcd.print(':');
LCDprint2digits(tm.Second);
lcd.setCursor (0, 1);
lcd.print(tm.Day);
lcd.print('/');
lcd.print(monthName[tm.Month-1]);
lcd.print('/');
lcd.print(tmYearToCalendar(tm.Year));
} else {
if (RTC.chipPresent()) {
lcd.println("DS1302 stoi. Uruchom Zegar");
}
else {
lcd.println("DS1302 blad oczczytu!");
lcd.println("sprawdz polaczenie");
}
delay(9000);
}
delay(1000);
}
//void print2digits(int number) {
// if (number >= 0 && number < 10) {
// Serial.write('0');
// }
// Serial.print(number);
//}
void LCDprint2digits(int number) {
if (number >= 0 && number < 10) {
lcd.write('0');
}
lcd.print(number);
}