Nano Super Mini Typ-C Board Atmega328p - internal LEDs

I do have this board and want to get the 3 multicolor LEDs work.

I don't get it. There is D2 mentioned, but I can't control 3 LEDs with multiple colors with just one signal, right?

So I iterated all pins in a loop (i=0...19) (j=0..19) so that each combination of High and Low for 2 pins happens at least ones for 200ms - in case I need a combination of 2 pins - but LEDs keep off.

How does it work?
As far as I figured out is D2=Pin2 ...D13=13 and
A0...5 can be addressed as 14..19 if configured as output. True?
D0, D1 doesn't exist?

void setup() {
  Serial.begin(115200);
  for (int pin = 0; pin <= 20; pin++) {
    pinMode(pin, OUTPUT);
  }
}

void loop() {
  for (int j=0; j<20; j++) {
    for (int i=0; i<20; i++) {
      Serial.print(i);
      Serial.print("\t");
      Serial.print(j);
      Serial.print("\n");
      digitalWrite(i, HIGH);
      digitalWrite(j, LOW); 
      delay(200);
      digitalWrite(i, LOW);
      digitalWrite(j, HIGH);
      delay(200);
      digitalWrite(i, HIGH);
      digitalWrite(j, HIGH); 
      delay(200);
      digitalWrite(i, LOW);
      digitalWrite(j, LOW); 
      delay(100);
    }
  }
}

Wrong. If they are "neopixels" (WS2812B) LEDs, you can.

I'm not clicking on the link, but if TZT doesn't have a manual/datasheet of the board, take a look at Adafruit Neopixel library and examples. Maybe you can find the answer you need.

Thay can be considered 14..19 if they are used as digital pins, being them in input or output mode.

They use to be RX and TX.

Ok, thanks.
Than D2 is the control pin for this 3 NeoPixels? Very interesting.
Edit: Can confirm, that works. You made my day!

It seems that this A0..A5 can be (if configured as Output) addressed with 14..19 switched on or off.
Otherwise that are analog inputs, aren't they? And only the D3..D13 can be used as digital input. Is that correct?

Yes.

Pins A0 to A5 on the Uno and Nano are connected to the chip ADC. So, their most common use is to receive analog signals. However, they can also be used as digital pins (D14 to D19) and, in this condition, be configured whether as outputs or inputs.

Happy to hear that! Have fun! :upside_down_face:

Das Board hat die Pins 5V und Vin. Eigentlich dachte ich es hat auch 3.3V, aber scheint gar nicht so. Oder ist das 5V Pin "flexibel"?

Hi @starbright. Please use the English language when posting in discussions where the established language is English.

For future topics, if you prefer to use the german language you are welcome to use the forum category we have dedicated to that purpose:

International > Deutsch

However, use of English has already been established in this topic, so german should not be used here. You are welcome to compose your posts in german and then run them through an automated translation service (e.g., Google Translate) before publishing them here.

1 Like

D13 seems to have a LED attched, so avoid using that pin as input.

Edit: Pin reference on this page.
3 NeoPixel LEDs connected to Arduino Pin 2.
That page also has Arduino neopixel code.
Leo..

Any pin (D0 .. D13) is a digital input after the board is reset. Once your code starts running it depends on what you do. As examples

  1. If you use Serial to communicate with the PC D0 and D1 will be used by the UART and the Tx pin becomes an output.
  2. If you use analogRead on e.g. pin A0 it becomes an analogue input.
  3. If you use analogWrite on a PWM capable pin that pin becomes an output.

For analogRead you can use both analogRead(A0) and analogRead(14). The former is preferred because, if you ever want to move to another board (e.g. Mega) A0 might not be pin 14.

The same for pinMode, digitalWrite and digitalRead. E.g. digitalWrite(A0, HIGH) will set A0 HIGH.

If the board behaves like the Uno, the 5V pin will provide 5V or accept 5V with very small "felxibility". You need to feed Vin with 7-12V. But whether it behaves like an Uno, only the board manual/datasheet can tell.

Thanks for your feedback. I hope I can run this board feeded (like a parasite) from an ebike controller - as it only needs little power. Want to attach speed and cadence sensor to it and simulate pressing the "brake" wire of this standard oem ebike controller which doesn't support out of the box the rules for a pedelec/epac.
To check power consumption and supply parasitic with ~4.6V (that I measured from the bike controller) is one of the next tasks. The former tested esp8266 was to hungry, both boards just don't work together.
Just have little space and don't want to spend another board that might return real 5V out of 30...46V.

Sorry one more question here: Can all input Pins handle IRQs, so to uses something like that?

  pinMode(SPEED_PIN, INPUT_PULLUP);
  attachInterrupt(digitalPinToInterrupt(SPEED_PIN), speedISR, FALLING);

There are two types of interrupts for pins.

  1. Only pins 2 and 3 on a 328P can use your approach.
  2. All pins can handle PinChangeInterrupts.

99.9% chance that the processor on that $1.74 board is fake.
You can't be sure of anything.
Treat it like an unreliable Chinese toy.
Leo..