Question

Using cron executing a bash script: -every 12 minutes get the temperture(Python) -Display the time, temperture,...

Using cron executing a bash script:

-every 12 minutes get the temperture(Python)

-Display the time, temperture, and location(curses)

-Blink the LED 20 times once every 5 seconds (C)

Using cron:

-Every 5 minutes send the temperture, location, and time to professor Donald's server (TCP-C)

-Blink the LED 40 times once a second(C)

-Professor Donald's return message will include a JSON string; display the returned "value" from Prof. Donald's

server in the middle of your screen(C and Curses?)

0 0
Add a comment Improve this question Transcribed image text
Answer #1

I am writing python code for getting temparature in every 12 minutes;

!/usr/bin/python/temp.py

import time

timeformat = time.strftime("Time_format: %H:%M, Date: %Y%m%d, ")

# Add the filename with the date for it will create new log daily

logname = time.strftime("")

filename = "".join(["/home/pi_programs/bredhult_temp.txt"])

# If already created, this will open the current log file, there is no need to create a new one

datafile = open(filename, "a")

textfile = open("/sys/bus/w1/devices/28-000006879f89/w1_slave")

# read the data and close the fil

text = textfile.read()

textfile.close()

# Split the data and extract the temperature value

temperature_data = text.split()[-1]

temperature = float(temperature_data[12:])

temperature = temperature / 1000

# write our newly formatted date, time and sensor value to our log file

datafile.write(timeformat + "Temp: " + str(temperature) + "\n")

datafile.close()

Add a comment
Know the answer?
Add Answer to:
Using cron executing a bash script: -every 12 minutes get the temperture(Python) -Display the time, temperture,...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT