Hi,
I've started using the Grove Rotary Angle Sensor (Potentiometer) as per Exercise 10 (p 83) in the "Introduction to Microcontroller Programming" EBlocks2 / Flowcode course. This is my first attempt to use Arduino Uno R3's A0 analogue input (on BL0055). It seems quite a leap from the 6 example examples to these later exercises because there is no EBlock2 datasheet entry for BL0655 and I haven't found any instructions for using the component macros other than one brief line per macro when my mouse cursor hovers over the title.
Are there any comprehensive instructions for these component macros AND is it possible to see / edit the component macro code / flow chart?
I note that if I use Arduino IDE analogRead() I can see 0 to 1023 ADC values as I rotate the pot. but with flowcode component macro GetInt() the range I can see is from 19 to 999 only.
Thanks.
Component Macro Documentation
-
- Posts: 7
- http://meble-kuchenne.info.pl
- Joined: Tue Nov 02, 2021 5:01 pm
-
- Matrix Staff
- Posts: 1926
- Joined: Mon Dec 07, 2020 10:06 am
- Has thanked: 503 times
- Been thanked: 686 times
Re: Component Macro Documentation
Hello,
The main source of component help at the moment is available here. Or by right clicking a component on the panel/toolbar and selecting help.
https://www.flowcode.co.uk/wiki/index.p ... Components
Currently the components are closed source unless you need to be able to see inside. I would imaging your limited range could be to do with the ADC properties of the component. Can you attach your project so we can have a look and advise what to try.
The main source of component help at the moment is available here. Or by right clicking a component on the panel/toolbar and selecting help.
https://www.flowcode.co.uk/wiki/index.p ... Components
Currently the components are closed source unless you need to be able to see inside. I would imaging your limited range could be to do with the ADC properties of the component. Can you attach your project so we can have a look and advise what to try.
Regards Ben Rowland - MatrixTSL
Flowcode Online Code Viewer (Beta) - Flowcode Product Page - Flowcode Help Wiki - My YouTube Channel
Flowcode Online Code Viewer (Beta) - Flowcode Product Page - Flowcode Help Wiki - My YouTube Channel
Re: Component Macro Documentation
Hi Ben,
Sorry it's taken so long to reply - I don't get chance to look at this every day.
The ADC seems to be able to read a full 10 bits as I get 0 to 1023 with Arduino IDE. I'm using A0 (C0) on Arduino Uno R3 (PDIP).
Here are both sets of code:-
Best wishes.
Sorry it's taken so long to reply - I don't get chance to look at this every day.
The ADC seems to be able to read a full 10 bits as I get 0 to 1023 with Arduino IDE. I'm using A0 (C0) on Arduino Uno R3 (PDIP).
Here are both sets of code:-
Best wishes.
-
- Matrix Staff
- Posts: 1920
- Joined: Wed Dec 02, 2020 11:07 pm
- Has thanked: 622 times
- Been thanked: 645 times
Re: Component Macro Documentation
Hi.
What have you got connected to AREF pin?
I have two things to suggest.
1 Change conversion speed from Fosc/8 to Fosc/128
2 Change Vref option to AVCC.
If VREF is the exact supply voltage or a bit lower then you should not need to use the second option.
Does it make any difference if you remove the connection to the angle sensor and directly connect A0 to the 5v supply pin?
In theory it should not if works with Arduino IDE.
What have you got connected to AREF pin?
I have two things to suggest.
1 Change conversion speed from Fosc/8 to Fosc/128
2 Change Vref option to AVCC.
If VREF is the exact supply voltage or a bit lower then you should not need to use the second option.
Does it make any difference if you remove the connection to the angle sensor and directly connect A0 to the 5v supply pin?
In theory it should not if works with Arduino IDE.
Martin
Re: Component Macro Documentation
Hi Ben,
We're using EBlocks2 and Flowcode as beginners in Microcontroller programming for a college course. Whilst it's true that I'm an Engineer and I do understand different ADC voltage references, sampling times and frequencies, we can't expect students who are new to microcontrollers to know this. Besides, Arduino IDE works 'out-of-the-box' giving 0 -255 (8 bit) or 0 - 1023 (10 bit) whereas Flowcode does not ... with the same hardware configuration, just different code compiled and sent to the Arduino Uno. When switching from the Arduino IDE program to Flowcode, nothing gets unplugged from the EBlocks2 BL055 Arduino shield and thus the same Grove rortary sensor is connected to the same port pin (via BL0129) all the time.
So, do the FlowCode component macros need work so they give the same answers as Arduino IDE? I've sent you the code. Have you tried it?
Please answer within the scope of someone learning microcontrollers from scratch and if necessary, refer the query to your Education support department so this works seemlessly with the FlowCode Beginners' course: [Matrix-TSL_Microcontroller compete course_v3.0.pdf].
Best wishes.
We're using EBlocks2 and Flowcode as beginners in Microcontroller programming for a college course. Whilst it's true that I'm an Engineer and I do understand different ADC voltage references, sampling times and frequencies, we can't expect students who are new to microcontrollers to know this. Besides, Arduino IDE works 'out-of-the-box' giving 0 -255 (8 bit) or 0 - 1023 (10 bit) whereas Flowcode does not ... with the same hardware configuration, just different code compiled and sent to the Arduino Uno. When switching from the Arduino IDE program to Flowcode, nothing gets unplugged from the EBlocks2 BL055 Arduino shield and thus the same Grove rortary sensor is connected to the same port pin (via BL0129) all the time.
So, do the FlowCode component macros need work so they give the same answers as Arduino IDE? I've sent you the code. Have you tried it?
Please answer within the scope of someone learning microcontrollers from scratch and if necessary, refer the query to your Education support department so this works seemlessly with the FlowCode Beginners' course: [Matrix-TSL_Microcontroller compete course_v3.0.pdf].
Best wishes.
-
- Matrix Staff
- Posts: 1926
- Joined: Mon Dec 07, 2020 10:06 am
- Has thanked: 503 times
- Been thanked: 686 times
Re: Component Macro Documentation
Hello,
We have looked into pre-setting the ADC configuration properties when using Arduino devices however it's not as simple as you might imagine as we are dealing with hundreds of chips not a handful of boards as with the Arduino IDE. Preloading the settings based on the device potentially has a bunch of knock on problems that would have to be very careful to circumvent. We will certainly keep exploring it and I have some ideas here on how that might be done but it's certainly not a simple fix.
For now it might be worth explaining to the students what the reference and conversion speed is and what it does as this could proove invaluable to them to a) get more resolution out of an ADC for a analogue sensor working at reduced voltage range and b) if they ever use a microcontroller outside of the Arduino enviroment they would be better equipped to understand whats going on.
Is this the course you are using?
https://www.matrixtsl.com/resources/fil ... course.pdf
I'll see if I can add some notes into this to help things along. Something like this in Appendix 1: Arduino: Section D - We recommend the following ADC settings to get the best functionality out of the ADC on the Arduino. The default settings require the use of the VREF pin and may yield more coarse samples due to the high conversion speed.
We have looked into pre-setting the ADC configuration properties when using Arduino devices however it's not as simple as you might imagine as we are dealing with hundreds of chips not a handful of boards as with the Arduino IDE. Preloading the settings based on the device potentially has a bunch of knock on problems that would have to be very careful to circumvent. We will certainly keep exploring it and I have some ideas here on how that might be done but it's certainly not a simple fix.
For now it might be worth explaining to the students what the reference and conversion speed is and what it does as this could proove invaluable to them to a) get more resolution out of an ADC for a analogue sensor working at reduced voltage range and b) if they ever use a microcontroller outside of the Arduino enviroment they would be better equipped to understand whats going on.
Is this the course you are using?
https://www.matrixtsl.com/resources/fil ... course.pdf
I'll see if I can add some notes into this to help things along. Something like this in Appendix 1: Arduino: Section D - We recommend the following ADC settings to get the best functionality out of the ADC on the Arduino. The default settings require the use of the VREF pin and may yield more coarse samples due to the high conversion speed.
Regards Ben Rowland - MatrixTSL
Flowcode Online Code Viewer (Beta) - Flowcode Product Page - Flowcode Help Wiki - My YouTube Channel
Flowcode Online Code Viewer (Beta) - Flowcode Product Page - Flowcode Help Wiki - My YouTube Channel