Close or Esc Key

Arduino Projects   |   Raspberry Pi   |   Electronic Circuits   |   AVR   |   PIC   |   8051   |   Electronic Projects

RTC-DS3231 C++ PROGRAMMING HELP ON RPI 3

2 posts / 0 new
Last post
Khalid
Khalid's picture
Offline
Last seen: 1 year 5 months ago
Joined: 31/07/2017 - 01:08
RTC-DS3231 C++ PROGRAMMING HELP ON RPI 3

Hi everyone,

Can anyone please help me in C++ code for RTC DS3231. I have the arduino code but I am struggling in changing the syntax on Raspberry pi as I am a beginner.

I am trying to create classes for writing time, alarms and set the square wave.

Thanks in advance.

Chris
Chris's picture
Offline
Last seen: 3 weeks 2 days ago
Joined: 28/12/2018 - 14:50
For module setup try the

For module setup try the following shell commands -
sudo apt-get update
sudo apt-get -y upgrade
Now modify a system file using :
sudo nano /etc/modules
If it isn’t already there add “rtc-ds1307” to the bottom so it looks something like :
snd-bcm2835
i2c-bcm2835
i2c-dev
rtc-ds1307

For I2C device -
sudo nano /etc/rc.local
Add the following two lines before the exit 0 line :
echo ds1307 0x68 > /sys/class/i2c-adapter/i2c-1/new_device
hwclock -s
Then
sudo reboot
sudo raspi-config
Then add date -
sudo date -s "28 DECEMBER 2018 13:00:00"
sudo hwclock -w
sudo hwclock -r

Thats all