Component Required
Moderator: Benj
-
- Posts: 315
- Joined: Sun Jun 23, 2013 1:29 pm
- Has thanked: 28 times
- Been thanked: 61 times
- Contact:
Component Required
Hi Ben
If possible would you be able to sort out a component for me (or tell me how to do it).
I require a push button switch which when pressed gives out a fixed analogue value, the value of which can be user altered in properties?
As you are no doubt aware some interface boards use a resistor ladder network connecting multiple switches to one analogue Pin.
Thank you
Matt
If possible would you be able to sort out a component for me (or tell me how to do it).
I require a push button switch which when pressed gives out a fixed analogue value, the value of which can be user altered in properties?
As you are no doubt aware some interface boards use a resistor ladder network connecting multiple switches to one analogue Pin.
Thank you
Matt
-
- Posts: 58
- Joined: Sat Aug 22, 2009 5:45 pm
- Has thanked: 17 times
- Been thanked: 7 times
- Contact:
Re: Component Required
Hi Docara.
Sounds like you need a pwm output and an RC filter(a resistor in series and a capacitor in parallel) after it, and by varying the dutycycle you will have an analog outputsignal.
About the values of the filter, it depends of how fast you need to alter the outputsignal.
regards
Nick
Sounds like you need a pwm output and an RC filter(a resistor in series and a capacitor in parallel) after it, and by varying the dutycycle you will have an analog outputsignal.
About the values of the filter, it depends of how fast you need to alter the outputsignal.
regards
Nick
- LeighM
- Matrix Staff
- Posts: 2178
- Joined: Tue Jan 17, 2012 10:07 am
- Has thanked: 481 times
- Been thanked: 699 times
- Contact:
Re: Component Required
Hi Matt
Try the attached.
Leigh
Try the attached.
Leigh
- Attachments
-
- AnSwitch.fcpx
- (2.19 KiB) Downloaded 238 times
-
- AnSwitch.fcfx
- (8.1 KiB) Downloaded 239 times
-
- AnSwitchTest.fcfx
- (9.62 KiB) Downloaded 241 times
-
- Posts: 315
- Joined: Sun Jun 23, 2013 1:29 pm
- Has thanked: 28 times
- Been thanked: 61 times
- Contact:
Re: Component Required
HI Leigh,
Thanks for the files. the way you have managed to bring simulated values into FC is something new to me.
Its not quite what I was after - perhaps a picture speaks a thousand words. I have purchased one of the following modules
https://www.maplin.co.uk/p/16x2-lcd-shi ... uino-n07dh
You will notice that located in the bottom left corner are 5 buttons connected to AN0. In my case theses values are (bytes) No Press = 249, RIGHT=4, UP=40, DOWN=86, LEFT=128 and SELECT =182
So what I was after is not a turning knob but a digital Push Button but giving out an equivalent analogue value to AN0. So when I pressed it on screen 86, say, would be delivered to the analogue routine.
Matt
Thanks for the files. the way you have managed to bring simulated values into FC is something new to me.
Its not quite what I was after - perhaps a picture speaks a thousand words. I have purchased one of the following modules
https://www.maplin.co.uk/p/16x2-lcd-shi ... uino-n07dh
You will notice that located in the bottom left corner are 5 buttons connected to AN0. In my case theses values are (bytes) No Press = 249, RIGHT=4, UP=40, DOWN=86, LEFT=128 and SELECT =182
So what I was after is not a turning knob but a digital Push Button but giving out an equivalent analogue value to AN0. So when I pressed it on screen 86, say, would be delivered to the analogue routine.
Matt
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: Component Required
Hi Matt,
How about this? Should hopefully work in simulation and on the real hardware. You will have to tweak the values in the Ev_Timer macro a bit to give you the values you mentioned but should be enough for you to work with.
For example 249 would be (1 / 255) * 249 = 0.9764
How about this? Should hopefully work in simulation and on the real hardware. You will have to tweak the values in the Ev_Timer macro a bit to give you the values you mentioned but should be enough for you to work with.
For example 249 would be (1 / 255) * 249 = 0.9764
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Posts: 315
- Joined: Sun Jun 23, 2013 1:29 pm
- Has thanked: 28 times
- Been thanked: 61 times
- Contact:
Re: Component Required
HI Ben
Thanks for the files, I have no problem reading the AN pin and/or assigning values I was just asking if it was possible to have a component which combined the operation and look of the existing Switch(Push,pcb) but give a fixed analogue value
I am unable to have 5 Pots on screen to simulate the five buttons because they all turn together, hence my request for assistance
Matt
Thanks for the files, I have no problem reading the AN pin and/or assigning values I was just asking if it was possible to have a component which combined the operation and look of the existing Switch(Push,pcb) but give a fixed analogue value
I am unable to have 5 Pots on screen to simulate the five buttons because they all turn together, hence my request for assistance
Matt
-
- 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: Component Required
Hi Matt,
I have modified Flowchart Ben Posted.
I have not created a component as not had time.
I hope Flowchart works for you.
Martin
I have modified Flowchart Ben Posted.
I have not created a component as not had time.
I hope Flowchart works for you.
Martin
- Attachments
-
- AnInSim2.fcfx
- (19.25 KiB) Downloaded 239 times
Martin
-
- Posts: 315
- Joined: Sun Jun 23, 2013 1:29 pm
- Has thanked: 28 times
- Been thanked: 61 times
- Contact:
Re: Component Required
HI Kersing
Thank you for the file but I'm afraid its not what I am looking for.
I know how to read an ADC value I just want a fixed value when a button is pressed.
I have included the schematic so you can see where I'm coming from - look at the five switches all connected to AN0 via a resistor ladder network. These are the switches I want to replicate in FC
Thanks
Matt
Thank you for the file but I'm afraid its not what I am looking for.
I know how to read an ADC value I just want a fixed value when a button is pressed.
I have included the schematic so you can see where I'm coming from - look at the five switches all connected to AN0 via a resistor ladder network. These are the switches I want to replicate in FC
Thanks
Matt
- Attachments
-
- LCD Shield Sch2.pdf
- (97.78 KiB) Downloaded 207 times
-
- 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: Component Required
Hi Matt,
It does not Read ADC.
in fact the ADC component has been completely removed from the flowchart!
You press the left button and 128 appears on LCD etc s that is just assigned to an existing variable called .
You can rename the variable to whatever you like.
Have you ran a simulation and pressed each button, observing what's displayed on LCD?
Martin
That is exactly what the flowchart does.Docara wrote:I just want a fixed value when a button is pressed.
It does not Read ADC.
in fact the ADC component has been completely removed from the flowchart!
You press the left button and 128 appears on LCD etc s that is just assigned to an existing variable called
Code: Select all
ADC
You can rename the
Code: Select all
ADC
Have you ran a simulation and pressed each button, observing what's displayed on LCD?
Martin
Martin
-
- Posts: 315
- Joined: Sun Jun 23, 2013 1:29 pm
- Has thanked: 28 times
- Been thanked: 61 times
- Contact:
Re: Component Required
Medelec,
I am SO sorry I did you a disservice - no I didn't run the code .
I don't use the 3D Panel I took a quick look at the code saw nothing in the 2d panel and didn't see the LCD component on the chart I thought it was just reading the ADC port - (I think I need to apologise to Ben and Possible Leigh for the same reason) I was expecting to see a button (1) which I would use to build the five not a fully configures 'system'
Initial impressions are that it works like a charm I can't thank you enough.
Let me have a play and I'll get back to you
Thank you
Matt
I am SO sorry I did you a disservice - no I didn't run the code .
I don't use the 3D Panel I took a quick look at the code saw nothing in the 2d panel and didn't see the LCD component on the chart I thought it was just reading the ADC port - (I think I need to apologise to Ben and Possible Leigh for the same reason) I was expecting to see a button (1) which I would use to build the five not a fully configures 'system'
Initial impressions are that it works like a charm I can't thank you enough.
Let me have a play and I'll get back to you
Thank you
Matt
-
- Posts: 315
- Joined: Sun Jun 23, 2013 1:29 pm
- Has thanked: 28 times
- Been thanked: 61 times
- Contact:
Re: Component Required
To Ben and Leigh
Further to my recent PM to you both and for the reasons posted above, I'm sorry I didn't give the work you did for me fair consideration.
I wanted to publically acknowledge that I was wrong implying you guys didn't produce what I asked for - you did.
Matt
Further to my recent PM to you both and for the reasons posted above, I'm sorry I didn't give the work you did for me fair consideration.
I wanted to publically acknowledge that I was wrong implying you guys didn't produce what I asked for - you did.
Matt
-
- Posts: 26
- Joined: Tue May 23, 2017 1:55 am
- Been thanked: 1 time
- Contact:
Re: Component Required
i have used the lcd sheild just reading a single analogue value and then lots of decisions but i agree a component would be good as you can get nice keyboards that only use a single pin of you microcontroller and have up to 16 buttons
-
- Posts: 26
- Joined: Tue May 23, 2017 1:55 am
- Been thanked: 1 time
- Contact:
Re: Component Required
this may help you it is only an idea at the moment as there are some serious issues with the dmx recive , it uses an uno and lcd sheild the buttons alow you to set the dmx address and save it , it should work as it is if you want to play with something
- Attachments
-
- dmx_lcd_sheild.fcfx
- (27.54 KiB) Downloaded 162 times
-
- Posts: 315
- Joined: Sun Jun 23, 2013 1:29 pm
- Has thanked: 28 times
- Been thanked: 61 times
- Contact:
Re: Component Required
Hi Medelec,
How are you passing the values of the switches into the ADC variable, I cant see anything in properties etc
thanks
Matt
How are you passing the values of the switches into the ADC variable, I cant see anything in properties etc
thanks
Matt
-
- 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: Component Required
Hi Matt,
If you look at Ev_Timer macro, you can see that a value has been assigned to a decision branch for each switch: Martin
If you look at Ev_Timer macro, you can see that a value has been assigned to a decision branch for each switch: Martin
Martin
-
- Posts: 315
- Joined: Sun Jun 23, 2013 1:29 pm
- Has thanked: 28 times
- Been thanked: 61 times
- Contact:
Re: Component Required
Hi Martin,
I'll be damned!!!!!
Does this get added to the compiled or is it just simulation?
Oh by the way the routine works like a charm thank you again
Matt
I'll be damned!!!!!
Does this get added to the compiled or is it just simulation?
Oh by the way the routine works like a charm thank you again
Matt
-
- Posts: 26
- Joined: Tue May 23, 2017 1:55 am
- Been thanked: 1 time
- Contact:
Re: Component Required
you will be better looking at the higer swicth value first and use the > rather than = to allow for tolerences in the components ,, is if the vales shoud be 128 then 100 use > 114 as it is in between the 2 values , dont forget the board is probably built using 5% resistors giveing a max error of 10% as one could be 5% high and the other 5% low
-
- 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: Component Required
Its simulation only, so you can do the normal ADC reading.Docara wrote:Does this get added to the compiled or is it just simulation?
If you want to create your flowchart, I can amend it to work with both hardware and simulation.
Pleasure, glad it works.Docara wrote:Oh by the way the routine works like a charm thank you again
Martin
Martin