|
Post by mi6kata on Mar 21, 2023 7:40:11 GMT
Hello! I recently purchased my new TC375 Shieldbuddy and used Aurix IDE and the Arduino Ide for programming it and I am very satisfied with the debugging system and both environments. However I am trying to read analog signal from the A0 pin of the board, unfortunately with no great success.
void setup() { SerialASC.begin(115200); }
void loop() { SerialASC.println(); SerialASC.print("The value of A0 is "); SerialASC.println(analogRead(54)); delay(500); }
This is my code that I wrote in Arduino Ide based on the TC357 ShieldBuddy UserManual and the result printed on the serial monitor is: The value of A0 is The value of A0 is The value of A0 is The value of A0 is The value of A0 is The value of A0 is The value of A0 is The value of A0 is The value of A0 is
and the code stops after the last cycle. I tried to use the A0 pin as normal digital pin and it works well so I guess that means the problem is not in the pin. Can somebody tell me is the problem in the code or in the board. Thanks in advance.
|
|
|
Post by mi6kata on Mar 21, 2023 9:00:53 GMT
So I found that in the documentation of TC275 ShieldBuddy there is a function ReadAD0 which is the right function for reading analog pins, but there is no implementation for that function in the TC375 ShieldBuddy user manual.
|
|
|
Post by Admin on Mar 30, 2023 9:14:14 GMT
The ReadAD0() function is implemented on TC375! You could also use analogRead(0). The 54 is the digital pin number.
|
|
|
Post by ph30n1x on Jun 3, 2023 4:50:42 GMT
I am in process of converting a working Arduino IDE project from a Mega2560 to a Shieldbuddy TC375 and ran into a issues with AnalogRead. Within Setup I have multiple AnalogRead and the MCU would lock up on the third AnalogRead for port A3 (I also tried A7). If I commented out the read the code would continue. I saw references to the ReadAD0 function in this thread, so I tested ReadAD3() and it worked without issue. Are there some kind of limitation etc of AnalogRead that justified the creation of ReadAD0? I would rather use AnalogRead while converting the code so that I can quickly reassign ports if need be (as I already had for the DAC & CAN ports as I was using those as Analog ports on the Mega2560)
|
|
|
Post by ph30n1x on Jun 4, 2023 11:27:23 GMT
So far I am not really happy with the state of the Arduino integration for the TC375, I have been forced to change a lot of code and libraries to use ReadADx commands just to get things running. I have now run into Serial1 not working at all, but moving to Serial0 worked!
This board is not a replacement for a Mega2560 or Due
|
|