Code: Select all
$i2cdetect
$i2cdump
$i2cget
Code: Select all
$ i2cdump -y -r 0x0-6 0 0x68
0 1 2 3 4 5 6
00: 51 51 21 01 14 01 17
//to read seconds only
$ i2cdump -y -r 0x0 0 0x68
$ 0x51
//read hour only
$ i2cdump -y -r 0x2 0 0x68
$ 0x21
Code: Select all
#!/bin/bash
//create variable that is current RP system time and will be amended with correct RTC time
old = $(date)
// create string variable using RTC time
new = $(i2cdump -y -r 0x0-6 0 0x68)
//change 'old' to 'new'
date -s '$new'