Posts

Raspberry Pi Light Sensor

Image
Required Raspberry Pi Ethernet Cord  or  Wifi dongle Light sensor  (LDR Sensor) 1uF Capacitor #!/usr/local/bin/python import RPi.GPIO as GPIO import time GPIO.setmode(GPIO.BOARD) #define the pin that goes to the circuit pin_to_circuit = 7 def rc_time (pin_to_circuit): count = 0 #Output on the pin for GPIO.setup(pin_to_circuit, GPIO.OUT) GPIO.output(pin_to_circuit, GPIO.LOW) time.sleep(0.1) #Change the pin back to input GPIO.setup(pin_to_circuit, GPIO.IN) #Count until the pin goes high while (GPIO.input(pin_to_circuit) == GPIO.LOW): count += 1 return count #Catch when script is interrupted, cleanup correctly try: # Main loop while True: print rc_time(pin_to_circuit) except KeyboardInterrupt: pass finally: GPIO.cleanup() http://pimylifeup.com/raspberry-pi-light-sensor/

How to access Windows drives from Ubuntu

sudo apt-get update  sudo apt-get install ntfs-3g sudo mkdir /media/windows sudo fdisk -l Disk /dev/sda: 1000.2 GB, 1000204886016 bytes 255 heads, 63 sectors/track, 121601 cylinders, total 1953525168 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 4096 bytes I/O size (minimum/optimal): 4096 bytes / 4096 bytes Disk identifier: 0x2bfb4dc8    Device Boot      Start         End      Blocks                Id       System /dev/sda1   *        2048      718847      358400              7       HPFS/NTFS/exFAT /dev/sda2          718848   409602047   204441600       7       HPFS/NTFS/exFAT /dev/sda3       409602110  19378...