Light sensor Python script

“””script to read a Light Dependent Resistor on GPIO pin 11 must be run in command line: –login as root >sudo su — run python command from directory >python lightsensor.py — ctrl-C to quit “”” #!/usr/bin/python import time import os import RPi.GPIO as GPIO GPIO.setmode(GPIO.BOARD) def LDRtime(LDRpin): reading = 0 GPIO.setup(LDRpin, GPIO.OUT) GPIO.output(LDRpin, GPIO.LOW) time.sleep(0.1)… Continue reading Light sensor Python script

Local iMac db setup

status at 20151117: Python script ok. Failing at the MySQL commit as the primary key stuff is not letting the data into the table. To do: add data to the sensor table. check PKs and FKs. check them again. Look at using python to check for duplicates instead of doing it this way.

Setting up iMac (OSXYosemite 10.10.5)

$ sudo easy_install pip $ sudo pip install -U setuptools $ sudo pip install pyserial install MariaDB as that is what is installed on pew == make sure Xcode is uptodate or install it $ xcode-select –install install homebrew $ ruby -e “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)” Check Homebrew $ brew doctor Update Homebrew $ brew update… Continue reading Setting up iMac (OSXYosemite 10.10.5)

Python tips

Creating the code on Mac OS, to switch to Pi later ensure pip install and upgraded $ sudo pip install -U setuptools $ sudo pip install pyserial $ brew install mysql-connector-c ( on Mac OSX you need the mysql connection lib, will be installed if XCode installed apparently, see http://stackoverflow.com/questions/16182294/installing-mysql-python-on-mac-os-x) $ sudo pip install MySQL-python… Continue reading Python tips