Closed wollewald closed 1 year ago
I noticed that the SSOP20 pseudo pro-mini pin diagram does not list that the SWD pin can be used as analog input A7
I did not test if the other PE3 features are also available on the PE2/SWD pin. I would not be surprised if they are.
tested with:
const int analogInPin = A7; // Analog input pin that the potentiometer is attached to
const int analogOutPin = LED_BUILTIN; // Analog output pin that the LED is attached to (in this case a digital pin)
int sensorValue = 0; // value read from the pot
int outputValue = 0; // value output to the PWM (analog out)
void setup() {
// initialize serial communications at 9600 bps:
Serial.begin(9600);
}
void loop() {
// read the analog in value:
sensorValue = analogRead(analogInPin);
// map it to the range of the analog out:
outputValue = map(sensorValue, 0, 1023, 0, 255);
// change the analog out value:
analogWrite(analogOutPin, outputValue);
// print the results to the Serial Monitor:
Serial.print("sensor = ");
Serial.print(sensorValue);
Serial.print("\t output = ");
Serial.println(outputValue);
// wait 2 milliseconds before the next loop for the analog-to-digital
// converter to settle after the last reading:
delay(2);
}
@hmeijdam Yes, you are right, and I will also add A6 input for SWC/PE0. Will add both.
Done
@hmeijdam Yes, you are right, and I will also add A6 input for SWC/PE0. Will add both.
That A6 was a surprise for me as on the LQFP32 it is on PE1, but just tested and can confirm it works.
The pinout of the SSOP20 is overall a bit weird: PF1 is available, but this is not mentioned in the data sheet. OC3A should be available at RESET according to the pinout diagram in the data sheet, but it isn't, even if RESET is changed to a normal I/O pin. TX/RX are available at PD5 / PD6, and there's no PD0 / PD1. A bit confusing.
Thank you!
Now I almost tested every single pin of all the lgt8f328p boards and still found issues / opportunities for improvement. I changed the following:
All boards:
LQFP48 ("Big Nano style):
Several changes to the SSOP20 (Pro Mini style) board:
I hope I have not missed any other mistake!