08m Digital input.

pjl83

Member
The only explanation I could find on inputs was this from manual 1 - "Inputs:
An input should be above (0.8 x power supply voltage) to be high, below (0.2 x
power supply voltage) to be low. It is recommended, but not essential, to tie
unused inputs low via a 10k resistor."


If I wanted to wire a push button to an input, should I go between the pin (say 3 for example) and the +volts rail?

Thanks
Paul
 

John West

Senior Member
The input needs to be read as either a high or a low. The pushbutton most usually shorts the input to ground while an open pushbutton condition should allow the input to be pulled high through a pull-up resistor to the positive power supply voltage pin.

Manual 1, page 65 shows the hook-up - although they show it in the opposite logic configuration. Either way will work.
 
Last edited:

eclectic

Moderator
From Manual 2

P. 129 Let dirs = % …..

P. 131 Let pins = %......

Manual 3

P. 25 / 26 Switch interfacing and bounce


e
 

pjl83

Member
Page 65 of manual 1 shows the diagrams that I was looking for. Thanks for that.

I'll keep it simple for now by using pin3 which is an input only on the 08m, once I'm happy with a few commands then I'll try some more complicated like the pages that electic suggested.

Thanks again
 

pjl83

Member
I got the push button wired as described in the manual and all is working fine using if...... then. I can make things happen whilst the button is pressed.

Is it possible to change the state of a circuit with just one push? I've got a red LED, a green LED and a push button connected to the 08m. What if I wanted to swap the LED's over each time the button is pressed? (e.g. red on green off then red off green on after a press etc) I've tried a few variations or simple code but feel as if I am missing a command or sequence.

main:
if pin3 = 1 then flash
goto main

flash:
high 4
pause 100
low 4
goto main

This is the simple code that I am using to turn the green led on whilst the button is pressed.

I am looking to learn as best as I can without asking for the answer too easily. I feel I just need a prod in the right direction. I have searched the manuals and the forum but can not find a similar example.

Thanks
 

BeanieBots

Moderator
Maybe something like this?

Code:
main:
if pin3 = 1 then flash
goto main

flash:
toggle 4
pause 100
goto main
You can also use your if/then to set a variable value and then test that variable to do all manner of complex switching.

I'm sure others will chip in with some fancy examples.
 

pjl83

Member
The toggle works great for one LED but I just can't get how to "swap" LED's. I need to have one LED lit when the programme starts and then toggle it off with the press. :confused:
 

pjl83

Member
perfect. thanks for that.

Is this kind of stuff found out just from the 3 manuals? I've searched for books but couldn't find much. The manuals are good but it's almost as if you have to know what you're looking for before you can find it.
 

BeanieBots

Moderator
It's really a question of reading each command in detail and fully understanding what they do. Then you use your imagination on how they can be put together to do what you want.

Reading example code can also be a very useful way to get tips on good ways of doing something.
 
Top