Button To Run A File

Status
Not open for further replies.
i'll just write it like::

led high
delay 10
led low
delay 9
led high
delay 8
led low


who cares i'm bored
 
@josh, delay will prevent you doing other things while it is operating. However a simple counting routine could be done within a for loop,but this may introduce other issues regarding access to the programme that you would need to think about. A for loop would go something like:

for(int x=10; x>0; x--){
pinlow;
delay(x);
pinhigh;
delay(x);}

the problem would then be that the delays get so short that the led would get dimmer and dimmer as the on time is shortened.

an option would be to have a separate function that contains the blink, with a fixed on time, such as:

void blink() {
pinlow;
delay(200);
pinhigh;
}
(or whichever way high and low go, )

and in your for loop use:
for..... {
blink();
delay(x);
}
 
Last edited:
thats cool.. i looked at the coding examples while and for loops, and also the metro blink.. i can kind of see it but its still confusing.. like lets say i want to turn on a fan every 24 hours and have an led, the on board one or whatever, have the led blink a countdown like it blinks 24 times until its at countdown 23 hours and then it blinks 23 times until it gets to 22 hours into the countdown, and so until it turns on the fan and then starts over.

thanks yall lot of great help
 
@josh, delay will prevent you doing other things while it is operating. However a simple counting routine could be done within a for loop,but this may introduce other issues regarding access to the programme that you would need to think about. A for loop would go something like:

for(int x=10; x>0; x--){
pinlow;
delay(x);
pinhigh;
delay(x);}

the problem would then be that the delays get so short that the led would get dimmer and dimmer as the on time is shortened.

an option would be to have a separate function that contains the blink, with a fixed on time, such as:

void blink() {
pinlow;
delay(200);
pinhigh;
}
(or whichever way high and low go, )

and in your for loop use:
for..... {
blink();
delay(x);
}

sweet got it.. just make a routine for every hour, thats a lot easier.. awesome thanks
 
hey, having an issue..

when i isolate the power from the usb cable my serial connection is not functioning to the computer but when i supply power from the usb the teensy resets periodically.. i have turned off power management to usb, and teensy does not reset when using battery power.. anyone run into this before?
 
nevermind it crapped out again.. it did work for a second..i guess its like trying to get a 3.1 with pins.. talk about some 404s i mean god whatevs
 
Not seeing an accurate drawing or pic of what you are connecting today on this older thread.

not a hardware guy - but AFAIK - from my reading here and what has worked for me::

Teensy must get a single power source - if connecting USB to a Teensy powered on 3.3V or VIN - then the VUSB power needs to be cut as documented elsewhere and the Teensy card..

If connecting another device sharing pins like Rx/Tx - then there must also be a common ground to that device. Connected serial device must be 3.3 V levels.
 
i hear ya.. its like one time i tried to video myself sleeping, i even hooked up a parabolic microphone that would come on to record the audio so i could hear myself talking in my sleep.. when i got up and watched it it was just a loop of sound sleep with all the good parts edited out.. my shrink won't talk to me about watching his secretary at his main office when he's away because of hacker theory... don't get me wrong i don't think anybody is doing anything wrong, i think it's just part of the broadcast.
 
okay maybe it's the code:
it's super simple:
blink on
blink off
// for time set sensor high low
lable
if high
delay 250
goto lable
else if low
command
// to keep from reset
delay 99999
else
delay 99999



edit:

the problem is after the sensor is triggered low it doesnt use delay and goes back to blink. and then command doesn't function on reset..
 
Last edited:
update: i think i know what happened.. i thought the relay that was controlling the input pin was 5v but after looking at the micro print its 24v.. whoops i guess that drained it and made it reset.. thanks for the advice and your patience..
 
Glad you got to the bottom of it! It is often some small detail that makes things turn the wrong way. In cases like these following:

pjrcFRule.PNG

Can make all the difference - sometimes collecting the details will make you see something you overlooked ( 24V .vs. 5V ) other times it will jump out at another member who can see a way to help. That goes for images 'as connected' sometimes - and others in presenting the source code simplified to reproduce the problem.
 
okay turns out it wasnt' the relay.. it was the wiring across two relays and didnt have enough amps so paralled 2 power supplies and it does work now, so far..
 
working fine now.. but hey i was thinking what if i put the glitch back in and change the program to give a logical answer like 1 blink for yes and 2 for no.. so when you trip the sensor it could tell you stuff?
 
s-l1600.jpg

so then it could say yes i like them or no i don't,, that is friggin wild man..
 
Status
Not open for further replies.
Back
Top