SparkFun Forums 

Where electronics enthusiasts find answers.

For the discussion of Arduino related topics.
By DEANJOSH48
#200691
Hi there my name is josh and im in immediate assistance of help I need help in creating some codes for my project for school
I need to make the following:
Raspberry pi 3b + Alexa with auto boot
Arduino uno lcd with border 20x4 lcd i2c

this is all for my GCSE project and any help what so ever will be graciously appreciated if this all can be done on one device please say because im a NOOB at this.

please contact me on the following:
Snapchat Deanjosh48
email Deanjosh48@icloud.com
instagram deanjosh48

many thanks

Josh

MY code IS
#include "Wire.h"
#include "LiquidCrystal_I2C.h"
#include "DS1307RTC.h"

LiquidCrystal_I2C lcd(0x3F, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE); // Set the LCD I2C address

byte verticalLine[8] = {
B00100,
B00100,
B00100,
B00100,
B00100,
B00100,
B00100,
B00100
};

byte char2[8] = {
B00000,
B00000,
B00000,
B11100,
B00100,
B00100,
B00100,
B00100
};

byte char1[8] = {
0b00000,
0b00000,
0b00000,
0b00111,
0b00100,
0b00100,
0b00100,
0b00100
};

byte char3[8] = {
0b00100,
0b00100,
0b00100,
0b00111,
0b00000,
0b00000,
0b00000,
0b00000
};

byte char4[8] = {
0b00100,
0b00100,
0b00100,
0b11100,
0b00000,
0b00000,
0b00000,
0b00000
};


void setup()
{
lcd.begin(20,4);

createCustomCharacters();

printFrame();
}

void loop()
{
tmElements_t tm;

if (RTC.read(tm)) {
printDate(5,1,tm);
printTime(6,2,tm);

} else {
if (RTC.chipPresent()) {

} else {

}
delay(9000);
}
delay(1000);
}

void printTime(int character,int line, tmElements_t tm)
{
String seconds,minutes;
lcd.setCursor(character,line);
lcd.print(tm.Hour);
lcd.print(":");
if(tm.Minute<10)
{
minutes = "0"+String(tm.Minute);
lcd.print(minutes);
}else
{
lcd.print(tm.Minute);
}
lcd.print(":");
if(tm.Second<10)
{
seconds = "0"+String(tm.Second);
lcd.print(seconds);
}else
{
lcd.print(tm.Second);
}
}

void printDate(int character,int line, tmElements_t tm)
{
lcd.setCursor(character,line);
lcd.print(tm.Month);
lcd.print("/");
lcd.print(tm.Day);
lcd.print("/");
lcd.print(tmYearToCalendar(tm.Year));
}

void printFrame()
{
lcd.setCursor(1,0);
lcd.print("------------------");
lcd.setCursor(1,3);
lcd.print("------------------");
lcd.setCursor(0,1);
lcd.write(byte(0));
lcd.setCursor(0,2);
lcd.write(byte(0));
lcd.setCursor(19,1);
lcd.write(byte(0));
lcd.setCursor(19,2);
lcd.write(byte(0));
lcd.setCursor(0,0);
lcd.write(byte(1));
lcd.setCursor(19,0);
lcd.write(byte(2));
lcd.setCursor(0,3);
lcd.write(byte(3));
lcd.setCursor(19,3);
lcd.write(byte(4));
}

void createCustomCharacters()
{
lcd.createChar(0, verticalLine);
lcd.createChar(1, char1);
lcd.createChar(2, char2);
lcd.createChar(3, char3);
lcd.createChar(4, char4);
}
User avatar
By phalanx
#200692
There is a stickied post on this forum about how to ask questions the smart way. I suggest you read it and apply the concepts to your post.

In addition, we need to know when this was assigned and when it is due so that we may judge the actual urgency.

-Bill