Erotic chat on aim - Updating computer lab

The third pin connects to a GPIO pin, and it is with this connection that we can communicate with the sensor.The resistor that we have put between this data pin and the high voltage pin is what is known as a pull-up resistor—unless the data leg grounds itself to send a 0 along the wire, its voltage on the wire will be "pulled-up" to 3.3V.

updating computer lab-31updating computer lab-5updating computer lab-9

What we have done here is set up a circuit from one of the GPIO pins, through the LED and resistor, down to ground.

With the Pi, we can switch on a specific GPIO pin, so it has a high voltage, and current will flow through the LED and resistor.

If you open up your Python script in IDLE and in Leafpad, you'll see that IDLE has added colour to the code—this is called syntax highlighting.

This is something that almost all text editors designed for writing code in do, because it makes it easier to see what is happening in the program. Sci TE is a bit quicker to open files, and looks simpler to start with, whereas Geany has lots more features that start to be useful when your program get a bit longer, such as listing all the names of variables in your program down the side, which makes it easier to remember what names have been used.

The code may be harder to read if it is squashed onto one line, however.

This operation can be made faster—play around with it, and if a quicker way becomes apparent, maybe a classmate can work out what it does? What we've done here is put the commands we typed out earlier into a script—so that we can easily run the program without having to type in all the commands again.

What actually happens when you try and read what is in the file is that the Pi sends a message to the temperature sensor asking it what the temperature is.

The sensor spends half a second or so working it out and sending it back (which is why there is a slight delay after you enter the command), at which point the Pi puts this information in the file and gives it back to you.

If we have the right program to work out what the data means, we can do even more complicated things.

We are going to be making use of a temperature sensor that sends the temperature information into a GPIO pin, and some software to convert this binary data into a useful format.

The kernel is the lowest level bit of software, that makes the connection between the actual hardware, and all the other software that can run.

Tags: , ,