Button action not working [Solved]

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 6.

Moderator: Benj

Post Reply
User avatar
JLeith
Posts: 537
Joined: Wed Nov 14, 2012 7:49 pm
Location: British Columbia Canada
Has thanked: 146 times
Been thanked: 26 times
Contact:

Button action not working [Solved]

Post by JLeith »

Hello All
It has been a while and with all this snow I thought I might sit on the computer and see if I can code a Halloween counter.

I took a program I had working and did a modification.
The expected action is
1. When the button "A0" is pressed the Quad thur the timer int advances 1
2. The NFR905 action TX the action to another receiver

My mystery is I can't figure out why when I enter Home macro the rerading of port A0 is high with no action on the button ?

I set the Spooky = 0 on starting

I have looked and looked and I know there is a simple answer but it escapes me.

John
Attachments
Button step.jpg
(143.24 KiB) Downloaded 1105 times
Halloween Spooky counter 2017.fcfx
(80.11 KiB) Downloaded 311 times

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: Button action not working

Post by medelec35 »

Hi John,
Have you got a pull-down resistor connected from Pin A0 to ground, and the switch connected from pin A0 to +5V?
If not using a pull-down resistor then Pin is probably floating, so electrical noise could be causing pin to go from logic 0 to logic 1 when switch is off.

Marin
Martin

User avatar
JLeith
Posts: 537
Joined: Wed Nov 14, 2012 7:49 pm
Location: British Columbia Canada
Has thanked: 146 times
Been thanked: 26 times
Contact:

Re: Button action not working

Post by JLeith »

Hello Martin
Great to hear from you.

Yes I do usually have a 1K gnd and have a 5v logic high.

I was trying to figure out why can I not get the Flowcode 6 to simulate ?

I found a very simple program that does allow the A0 button to work. I tried to add it to my program but could not get my program to function

Way back when we did the Servo actions we had the buttons working in flowcode. I checked back and the old servo project still works.

I have attached the "Demo program" I found trying to debug why could not get the A0 button action to work in my flowcode so I could track how to count and display up to 200 counts.

I could not explain why when I used F8 to step thru my code. When I stepped off the read of A0 the value of Spooky went to logic 1 ?

John
Attachments
Demo.fcfx
(7.97 KiB) Downloaded 320 times

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: Button action not working

Post by medelec35 »

Hi John,
I have just had a look at

Code: Select all

Halloween Spooky counter 2017.fcfx
The Quad 7Seg you have got within timer interrupt so the port it's connected to are being changed or a regular basis automatically.
One of the Pins is port A0 which is a common for 7seg0.
If you drag an LED on your panel and assign it with port A0, yo uwill be able to see it flashing.
Therefore if you want your project to work, it would be best to ether reassign Switch or Quad 7seg that's connected to A0 to a different pin.

Martin
Martin

User avatar
JLeith
Posts: 537
Joined: Wed Nov 14, 2012 7:49 pm
Location: British Columbia Canada
Has thanked: 146 times
Been thanked: 26 times
Contact:

Re: Button action not working

Post by JLeith »

Martin you are still a wizard. Great find

I was trying to see what pin were being used and I totaly forgot to do a mapping of the pins

Yes I changed the push button to B0 and the button is working.

There is a mental block when at least for me when I step away for 4 months.

All the best for 2017

John

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: Button action not working

Post by medelec35 »

Hi John,
No problem.
At least you are sorted.

Martin
Martin

Post Reply