setting up
// /* comment out i2c in black list in /etc/modprobe.d and reboot then run: sudo modprobe i2c-dev sudo chmod o+rw /dev/ic* */
int fd; // File descrition //char *fileName = "/dev/i2c-0"; // I nneded to change the device char *fileName = "/dev/i2c-1"; // address C6 so 63 is // Name of the port we will be using int address = 0x63; // Address of LCD03 shifted right one bit //int address = 0xC6; // Address of LCD03 shifted right one bit char buf[10]; if ((fd = open(fileName, O_RDWR)) < 0) { // Open port for reading and writing printf("Failed to open i2c port\n"); printf(" run: \n"); printf(" sudo modprobe i2c-dev \n"); printf(" sudo chmod o+rw /dev/i2c* \n"); exit(1); } if (ioctl(fd, I2C_SLAVE, address) < 0) { // Set the port options and set the address of the device we wish to speak to printf("Unable to get bus access to talk to slave\n"); exit(1); } buf[0] = 0; // Commands to clear the screen buf[1] = 12; if ((write(fd, buf, 2)) != 2) { // clear the screen printf("Error writing to i2c slave\n"); exit(1); } printf("Sending text to LCD03\n");
http://www.dougrice.plus.com/dev/rlcd1.c
http://hertaville.com/2012/11/18/introduction-to-accessing-the-raspberry-pis-gpio-in-c/
==========================================
http://www.hobbytronics.co.uk/arduino/arduino-lcd-keypad-shield http://elinux.org/RPi_BCM2835_GPIOs
http://pmb.neongrit.net/blog/?p=64 - LCD2x16 page
http://log.liminastudio.com/writing/tutorials/tutorial-how-to-use-your-raspberry-pi-like-an-arduino
This is a document about driving the GPIO.
http://quick2wire.com/2012/05/safe-controlled-access-to-gpio-on-the-raspberry-pi/
This is a document about driving the GPIO.
http://elinux.org/RPi_Low-level_peripherals#GPIO_Driving_Example_.28Bash_shell_script.2C_using_sysfs.2C_part_of_the_raspbian_operating_system.29
sudo -i
sleep 1 echo "1" > /sys/class/gpio/gpio22/value echo "0" > /sys/class/gpio/gpio23/value
sleep 1 echo "0" > /sys/class/gpio/gpio22/value echo "0" > /sys/class/gpio/gpio23/value =========================================================
echo "22" > /sys/class/gpio/unexport echo "23" > /sys/class/gpio/unexport echo "24" > /sys/class/gpio/unexport
</pre>
Used GPIO4 pin 7 - middle pin. 3v3 to power gnd to gnd
/ 3v3DS18S20 - top (|- buss --GPIO4--[4k7]--/
+
\ gnd
http://learn.adafruit.com/adafruits-raspberry-pi-lesson-11-ds18b20-temperature-sensing/hardware http://learn.adafruit.com/adafruits-raspberry-pi-lesson-11-ds18b20-temperature-sensing/hardware http://learn.adafruit.com/adafruits-raspberry-pi-lesson-11-ds18b20-temperature-sensing/ds18b20
sudo modprobe w1-gpio sudo modprobe w1-therm cd /sys/bus/w1/devices ls
cat 10-*/w1*
cd 28-xxxx (change this to match what serial number pops up) cat w1_slave
cat: power: Is a directory cat: subsystem: Is a directory DRIVER=w1_slave_driver W1_FID=10 W1_SLAVE_ID=00000000000000080189EF05 22 00 4b 46 ff ff 0c 10 3f : crc=3f YES 22 00 4b 46 ff ff 0c 10 3f t=17000 pi@raspberrypi /sys/bus/w1/devices/10-00080189ef05 $ cd .. pi@raspberrypi /sys/bus/w1/devices $ ls 10-00080189ef05 10-0008018a44f7 w1_bus_master1 pi@raspberrypi /sys/bus/w1/devices $ cd 10-0008018a44f7 pi@raspberrypi /sys/bus/w1/devices/10-0008018a44f7 $ ls driver id name power subsystem uevent w1_slave pi@raspberrypi /sys/bus/w1/devices/10-0008018a44f7 $ cat * cat: driver: Is a directory </pre>