how to hold a pin on HIGH
pico
Posts: 29
in Propeller 1
Hey guys,
I tested out the blink code for the propeller and I found out that the function that sets a pin high is different for the prop than from the one for the Arduino.
What I'm saying is, for the Arduino, digitalWrite(PIN, HIGH) sets the pin high and stays high. However, for the propeller, something like high(PIN) sets the pin high but after a fraction of a second goes down to low again. Is there any way to make the pin stay on high for the propeller?
Thanks!
I tested out the blink code for the propeller and I found out that the function that sets a pin high is different for the prop than from the one for the Arduino.
What I'm saying is, for the Arduino, digitalWrite(PIN, HIGH) sets the pin high and stays high. However, for the propeller, something like high(PIN) sets the pin high but after a fraction of a second goes down to low again. Is there any way to make the pin stay on high for the propeller?
Thanks!
Comments
things (cogs) that can change things - so another cog could be doing something with the pin, or if the cog responsible for driving the pin exits it disconnects from the pin completely at that point.
If you are using C, put the following line after high(pin) That will keep the program running until either the reset button is pressed or power to the propeller is disconnected.
/*
Blink Light.c
Blink light circuit connected to P26.
*/
#include "simpletools.h" // Include simpletools
int main() // main function
{
while(1) // Endless loop
{
high(26); // Set P26 I/O pin high
pause(1000); // Wait 1/10 second
low(26); // Set P26 I/O pin low
pause(1000); // Wait another 1/10 second
}
}
I simply uploaded this simple c program to my propeller board, and rather than having the LED on and then off, it flashes every second. Kinda like what would happen if I hooked up a button between the LED and the power source and I'm clicking the button every second. You know what I mean?
I think it is used by the serial protocol. I hooked the LED up to P2 and it works fine!
Thanks!