Configured the keyboard using the raspi-config program. Find the layout, then hit return to change the locations of the tilde and get the dollar sign instead of pounds sterling.
Apparently there is no root password created by default, so no root access except via sudo from pi.
Added www-data to the /etc/sudoers file. I'm not sure that's a great idea from a security point of view but it does let php run sudo tasks ;-) sudo adduser www-data dialout didn't make the serial port available, even though /dev/ttyAMA0 belongs to root and group dialout, but sudo adduser www-data tty did let www-data use the serial port without sudo. This means that the web server can run a program that sends data to and from the serial port to control something else external, like an Arduino. It also means I can take www-data out of the /etc/sudoers file and sudo deluser www-data dialout.
sudo apt-get install libi2c-dev to install the I2C support and then installed WiringPi for the familiar Arduino type interface and the ability to run without root privileges. Installed WiringPi-python for the wrapper. Unfortunately the export process is not getting me control of the pins. I'll need linux geek help with this one I think.
Serial Communications:
The Pi is 3.3V and other serial ports can be 5 V or more. Be careful. For a simple start I edited /etc/inittab to comment out the console getty near the end of the file.#Spawn a getty on Raspberry Pi serial line
#T0:23:respawn:/sbin/getty -L ttyAMA0 115200 vt100
minicom -b 57600 -o -D /dev/ttyAMA0
sudo apt-get install python-serial to get the serial library for python (API). This code will then read and write stuff to the serial port.
import serial
p = serial.Serial('/dev/ttyAMA0',57600)
while 1:
s = p.readline()
print s
p.write("this is what I think\n")
No comments:
Post a Comment