For my first project on the Raspberry Pi, I'd like to couple it with Arduino using a interconnection shield (like gertuino or chipkit32Pi)
to record analog data. However I want it to start recording by pressing a button (digital_input =True) and stop recording when I press the same button again (if digital_input = True; digital_input = False) and once the button is pressed the second time, it should save all the data that was accumulated in the time-frame, to a .csv or .xls file (whatever is easier I guess).
The .csv will be saved into a directory in the Pi, which is connected to a network, where I'll drag it out from the main computer in the network.
My 3 month experience Python (with syntax errors) Psudocode will be of the form:
I need help for me to enable me to do this though:). Would anybody guide me?
Code: Select all
"""" Setup """" import RPi.GPIO as GPIO CHANNEL = 7 ## Channel 7 constant GPIO.setup(CHANNEL, GPIO.IN) ## Set GPIO pin 7 """ Boolean Generator helper function """" ## should integrate a debounce code def boolean_generator(): press_incrementer = 0 ## if GPIO.input(CHANNEL) = True: ## current flows into the channel when button is pushed press_incrementer += 1 return boolean_var = press_incrementer % 2 ## Take modulus 2 to create 1,0,1, etc to create the numerical boolean state if boolean_generator() = 1: "Record serial data from Arduino" else: "Stop recording data from Arduino" "Automatically save the accumulated data into a .csv file in a directory of the RPi.