Python Forum
Some random (and probably dumb) questions
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Some random (and probably dumb) questions
#2
Quote:1. If I want to use the pi to say, control some lights, act as a thermostat and turn a fan off and on, would this generally be best done with a separate program for each running simultaneously? Or is there a way to do this all in one giant program? I've read some about threading, but currently its above my head.
If you are going to be turning on lights, etc, you will need some sort of power switcher, a relay for example,
or one of these: https://www.adafruit.com/product/3051
which will allow controlling devices remotely. These devices usually come with instructions on how to program.
You can also get some ideas here: https://hackaday.com/
and here: https://makezine.com/ there are many more sites another good one: https://forum.allaboutcircuits.com/

I think by spending time in some of these sites, you're other questions will be addressed just by the content of various projects.

Flashing an led is usually done by assigning some GPIO pins for that purpose

Quote:2. If I write a program to for example read a temp probe and return the value as x and have it running constantly in the background, is there a way I can reference my variable x in separate programs? For example could I have a script running that turns an LED off and on depending on the value of x, but in another script have x printed to the screen when condition z happens or something? I really don't know how to word this one to search for it.
this code is about reading sensors on pi: https://stackoverflow.com/questions/4203...-raspberry

Quote:3. As I understand programs are executed from top to bottom. If I have a condition that lets say I want to make an LED flash when true, how is this normally done?
this shows you how to do that: http://www.instructables.com/id/Blinking...erry-Pi-1/
Reply


Messages In This Thread
RE: Some random (and probably dumb) questions - by Larz60+ - Mar-12-2018, 01:31 AM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020