Oct-15-2018, 03:26 PM
I am very new to Pi, Python, and this kind of programming, as a whole.
I am building a data logger. Once completed, it will be deployed in areas with no internet connectivity. So I chose to create the build based on Widgetlords Real Time Clock Interface, Analog Input Interface and Digital Input Interface. There is an issue with the real time clock (I am working with VP Process to resolve it), therefore; I am having to enter the date and time manually. Once deployed, I want to ensure that the time and date are set before starting to collect data, so I added an input at the beginning of the script to ask for the date and time, and then set the time based on that.
This portion of the script works properly. When I execute the script, it asks for the date. Once entered, it asks for the time. Once entered, you can see the time and date adjust to what was input.
However, after executing this part of the script, it does not move on to the rest of the code. It just stops there.
Here is a little more of the code so you can see the context.
What am I missing that is not allowing the code to continue to execute after the command line sequence has completed?
I am building a data logger. Once completed, it will be deployed in areas with no internet connectivity. So I chose to create the build based on Widgetlords Real Time Clock Interface, Analog Input Interface and Digital Input Interface. There is an issue with the real time clock (I am working with VP Process to resolve it), therefore; I am having to enter the date and time manually. Once deployed, I want to ensure that the time and date are set before starting to collect data, so I added an input at the beginning of the script to ask for the date and time, and then set the time based on that.
1 2 3 4 5 |
#Set System Time and Date Real_Date = input ( 'Please enter date (ex. 10/15/2018)' ) Real_Time = input ( 'Please enter time (ex. 09:57:00)' ) os.system( "sudo date -s '%s %s'" % (Real_Date, Real_Time)) |
However, after executing this part of the script, it does not move on to the rest of the code. It just stops there.
Here is a little more of the code so you can see the context.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
import os from time import sleep import time from widgetlords.pi_spi_din import * from widgetlords import * #Set System Time and Date Real_Date = input ( 'Please enter date (ex. 10/15/2018)' ) Real_Time = input ( 'Please enter time (ex. 09:57:00)' ) os.system( "sudo date -s '%s %s'" % (Real_Date, Real_Time)) init() inputs = Mod8AI(ChipEnable.CE1) inputs = Mod8DI(ChipEnable.CE2) while True : #Time - ts = Timestamp, rt = Real Time ts = time.time() rt = time.ctime(ts) #Data Logging Files - Amp_File (Current Transducer Log), Pressure_File (Pressure Tranducer Log) Amp_File = open ( "/home/pi/Documents/Amp_File.txt" , "a" ) Pressure_File = open ( "/home/pi/Documents/Pressure_File.txt" , "a" ) |