80 Replies
Unknown UserOP•4y ago
Message Not Public
Sign In & Join Server To View
Ok please say exactly what you want to happe? "latching a signal" is very vauge.
this is blocking code, but it any state is HIGH then the led would blink. this is correct code.
@Trezzix
Unknown UserOP•4y ago
Message Not Public
Sign In & Join Server To View
intresting. thinking about this.
Unknown UserOP•4y ago
Message Not Public
Sign In & Join Server To View
ha ha ha
so to start, you will need to remove all delays and use millis, do you know how to use millis yet?
Unknown UserOP•4y ago
Message Not Public
Sign In & Join Server To View
OK so look into that, and in the ean time, provide a wireing diagram, and the full code when you can, because you will be needing to create a state machine it sounds like to me.
Unknown UserOP•4y ago
Message Not Public
Sign In & Join Server To View
you type in ``` arduino
with no spaces on the first line
!code
How to Send Code Blocks
Surround the code in three backticks
If using new lines, a file extension can be placed directly after the first 3 backticks to highlight in that language. An example is shown below, highlighting code in arduino. The backtick key is typically found to the left of the 1 key.

Arduino Bot • Submit bugs on GitHub!
so if your new to what a state machine does/is look that up too, but here is the basic of it. imagine you have 3 states. OFF, LEFT,RIGHT
then when you do something, it moves into that state, say left, and it stays in that state untill you tell to to move, or you set up a timmer or something to move it.
once you have that part working, then you have another part of the code, that looks at the current state [LEFT] then does things accordingly to that state [blink the left led]
This is just an over view, but it SOUNDS like what your trying to do?
Unknown UserOP•4y ago
Message Not Public
Sign In & Join Server To View
so the good news is that you can totaly do this. but like I mentioned you will need different tools. the millis will handleing the timers, and the state machine will take care of the logic part.
all of this will be done in code
Unknown UserOP•4y ago
Message Not Public
Sign In & Join Server To View
you have some code that is crossing.
lets reconfigure it a bit.
take a look at this, I changed nothing on it. just reformatted it a bit.
https://gist.githubusercontent.com/MaderDash/1fbc2257c5d7c6a28385144771a13b2f/raw/ae132aa204d11d6c5c4e7aa79df539fd72f6dbf8/Toggle.ino
please provide the wireing for your buttons please?
Unknown UserOP•4y ago
Message Not Public
Sign In & Join Server To View
Ok your buttons are wired incorrectly.
You need resistors for them
Unknown UserOP•4y ago
Message Not Public
Sign In & Join Server To View

Unknown UserOP•4y ago
Message Not Public
Sign In & Join Server To View
here is an example
pulldown but yeh
Unknown UserOP•4y ago
Message Not Public
Sign In & Join Server To View
anything from 10k to 1k is fine to use,
Unknown UserOP•4y ago
Message Not Public
Sign In & Join Server To View
do you listen to the radio at all?
Unknown UserOP•4y ago
Message Not Public
Sign In & Join Server To View
yes.
Unknown UserOP•4y ago
Message Not Public
Sign In & Join Server To View
well think about that for a moment, how a radio works, a wire way up in the air on a tower throws signals out into space/everywhere.
Then on your radio you have a wire sticking up. and the signals hit the wire on your radio and the radio makes the signal bigger so you can hear it.
do you follow me?
Unknown UserOP•4y ago
Message Not Public
Sign In & Join Server To View
well if you dont have that pin connected to something it becomes an antana, and can be high low or anything.
your BODY can trigger that pin, or like anything
Unknown UserOP•4y ago
Message Not Public
Sign In & Join Server To View
so if you place a resistor coneting that pin to GND then the signals still get onto that pin, but that small resistor gives them a path to leave the pin at, and that pin will never "charge" up.
no it wouldent because its EVERYWHERE so like your an antana, your laptop, your cellphone bots trans mints and recives ect ect
Unknown UserOP•4y ago
Message Not Public
Sign In & Join Server To View
😄
update when you rewire your buttons. 😄
Unknown UserOP•4y ago
Message Not Public
Sign In & Join Server To View
rotate your lines 90 deg
Unknown UserOP•4y ago
Message Not Public
Sign In & Join Server To View
oh wait.. now Im confused. 😄
so the blue lines would be TRUE if the button was pressed
BUT if the button is NOT pressed the blue lines get rotated 90 deg 😅
Unknown UserOP•4y ago
Message Not Public
Sign In & Join Server To View
so if you look at it NOT pressed this is what is happening. moment please drawing
this is the path while the button is NOT pressed

so the pin on the arduino is "pulled low".
Unknown UserOP•4y ago
Message Not Public
Sign In & Join Server To View
THIS is what happends when the button IS PREDDED

Unknown UserOP•4y ago
Message Not Public
Sign In & Join Server To View
now the 5v line is conected to the PIN side of the resistor, the resistor is now bleeding off the 5v as fast as it can but its just too slow, so the pin goes HIGH.
But as soon as you release the button the resistor can now lower the voltage fast enough to restore the pin LOW state. 😄
Whew that was a mouth full
are you understanding this stuff? @Trezzix 🥺
Unknown UserOP•4y ago
Message Not Public
Sign In & Join Server To View
because that is the way the switch is conected
ok lets see your wireing
Unknown UserOP•4y ago
Message Not Public
Sign In & Join Server To View
ok run this code and open the serial monitor then read the dat please.
wait
There Fixed try this onw
one
Unknown UserOP•4y ago
Message Not Public
Sign In & Join Server To View
the \t's
Unknown UserOP•4y ago
Message Not Public
Sign In & Join Server To View
ok good, no false triggering any more?
Unknown UserOP•4y ago
Message Not Public
Sign In & Join Server To View
Ok great one thing fixed. 😄
now the logic part.
Lets make a catch and release. 😄
Unknown UserOP•4y ago
Message Not Public
Sign In & Join Server To View
to be clear, the buttons show a 1 when pressed yes?
Unknown UserOP•4y ago
Message Not Public
Sign In & Join Server To View
I know I have not coded states yet
ok try this one and see what the serial monitor says.
@Trezzix??
Unknown UserOP•4y ago
Message Not Public
Sign In & Join Server To View
but whats it sat?
say
Unknown UserOP•4y ago
Message Not Public
Sign In & Join Server To View
but if you pres and hold the button down only one is displayed correct
Unknown UserOP•4y ago
Message Not Public
Sign In & Join Server To View
GREAT its working. 😄
now do you see how I did this?
you do the same thing that I did but for the RIGHT, and get it working.
Unknown UserOP•4y ago
Message Not Public
Sign In & Join Server To View
yeh this is a toggle code, so it will only run the code in the "pressed" part ONE TIME whhen the button is FIRst pressed,
Same for the "released" part too. only when released.
this is kind of what your doing in your code, but more moduler
when you get them both coded and working let me know and post the code. this will be the first part of the state machine.
Unknown UserOP•4y ago
Message Not Public
Sign In & Join Server To View
I tried to make it readable for you. @Trezzix
Unknown UserOP•4y ago
Message Not Public
Sign In & Join Server To View
this is no where close to what you need to do, and you failed to move forward with the progress we had made. 😦
Unknown UserOP•4y ago
Message Not Public
Sign In & Join Server To View
sure, it looks like you made the "right button work? "D
Unknown UserOP•4y ago
Message Not Public
Sign In & Join Server To View
correct. but is it working ?
@Trezzix please tag this post as solved if your done.
Unknown UserOP•4y ago
Message Not Public
Sign In & Join Server To View
@Trezzix Great and good job. 😄 I know it may had looked like something TOTALY different, but it was all conected. 😄 And TY for taggig