I realise how strange the title looks but according to the guide sheet here: https://docs.arduino.cc/tutorials/giga-r1-wifi/giga-audio/
CANRX and CANTX can be used as ADC pins - effectively taking the total to 16 (0 - 11, DAC0 and DAC1 all work fine).
I can't seem to get this to work however, as soon as I try to analogRead(CANRX) I get an error that CANRX is not a recognised pin.
Any suggestions please?
Hi, can you please share a code snippet, where you try to interact with the pin and which shows what libraries you are using?
No libraries involved.
Basic example:
void setup(){
Serial.begin(115200);
Serial.println("Booted");
}
void loop(){
uint16_t thisRead;
thisRead=analogRead(A0);
Serial.println(thisRead);
thisRead=analogRead(A13);
Serial.println(thisRead);
thisRead=analogRead(CANRX);
Serial.println(thisRead);
delay(1000);
}
This is just reading a couple of analog pins, but won't compile as CANRX is not recognised as a pin.
Thanks
Out of the blue I would try to #include CAN.h
or using the functions of the Arduino_AdvancedAnalog library.
1 Like
Hi @scolland ,
To use the pins from CAN RX and CAN TX, you can call them by "PB_5" and "PB_13" respectively.
void setup(){
Serial.begin(115200);
Serial.println("Booted");
}
void loop(){
uint16_t thisRead;
thisRead=analogRead(A0);
Serial.println(thisRead);
thisRead=analogRead(A13);
Serial.println(thisRead);
thisRead=analogRead(PB_5);
Serial.println(thisRead);
delay(1000);
}
Thanks for your message. That certainly allows the script to compile however the only possible readings are 0 or 65535 (I am ready 16 bit) - i.e. 0 or 1. I think the Arduino Giga documentation is wrong and these are actually digital pins only.
steve9
August 12, 2024, 4:30pm
7
A quick look at the code confirms CAN_RX/TX are not included in the analog pin list. They may be wired for it but they're not coded for it.