Project
Implement a function to wait for data, this will simulate our actuator in case no physical actuator is available
Go to your git "TheIoTLearningInitiative" repository, under "InternetOfThings101" directory
root@board:~# cd TheIoTLearningInitiative/InternetOfThings101
root@board:~/TheIoTLearningInitiative/InternetOfThings101#root@edison:~/TheIoTLearningInitiative/InternetOfThings101# vi main.py#!/usr/bin/python
import psutil
import signal
import sys
import time
def functionDataActuator():
print "Data Actuator"
def functionDataSensor():
netdata = psutil.net_io_counters()
data = netdata.packets_sent + netdata.packets_recv
return data
def functionSignalHandler(signal, frame):
sys.exit(0)
if __name__ == '__main__':
signal.signal(signal.SIGINT, functionSignalHandler)
while True:
print "Hello Internet of Things 101"
print "Data Sensor: %s " % functionDataSensor()
time.sleep(5)
# End of FileLast updated