![]() I guess you needed them set to inputs tho, so I guess I got that backwards. Mega has 11 ports (88 IO), altho not all pins have 8 IO pins, and not all IO pins are brough out to connectors on the Mega2560 board I don't know what's brought on your DFRduino, so I figured just set them all to outputs. ![]() I used register access 'shortcut' to set 8 outputs at a time vs looping thru pinMode. The port pins are tri-stated when reset condition becomes active, ![]() To switch the pull-up resistor off, PORTxn has to be written logic zero or the pin has toīe configured as an output pin. If PORTxn is written logic one when the pin is configured as an input pin, the pull-up resistor isĪctivated. If DDxn is written logic zero, Pxn is configured as an input The DDxn bit in the DDRx Register selects the direction of this pin. As shown in ”Registerĭescription” on page 91, the DDxn bits are accessed at the DDRx I/O address, the PORTxn bitsĪt the PORTx I/O address, and the PINxn bits at the PINx I/O address. Read the datasheet, many answers are there:Įach port pin consists of three register bits: DDxn, PORTxn, and PINxn. Im very new and know nothing about this arduino can i ask some reference where can i learn more about this arduino? maybe you know some recommended ebooks for me to buy. Can you give me a little explanation about your code? what is the difference between DDRG = 0xff and pinmode(1, OUTPUT) ? and what was DDRA-DDRF mean? Im sorry for my newbie question. You said that your code is use to set ports as output. Otherwise some pins will be low, and others high creating effectively a dead short. Secondly, you have to be careful to change all the pins at exactly the same time. The sum of all IOH, for ports F0-F7, K0-K7 should not exceed 100mA. Serial.begin(9600) // set up Serial library at 9600 bps The sum of all IOH, for ports E0-E7, G5 should not exceed 100mA. Many ‘simple’ LEDs are bright enough at 5mA. Each pin can provide or receive a maximum of 40 mA and has an internal pull-up resistor (disconnected by default) of 20-50 kOhms. So if you want to be able to run the whole strip at full brightness, you should use a separate power supply for the LEDs. Each of the 54 digital pins on the Arduino 2560 Mega can be used as an input or output, using pinMode (), digitalWrite (), and digitalRead () functions. Using simple code like this void setup() // run once, when the sketch starts So if each LED is drawing 20 mA max, the maximum current of your 16 addressable LEDs is 20 x 3 x 16 960 mA. So i detect 11 sensor using pin number 2-13 and 31 sensors using pin number 22-53. You was right Waski only pin number 2-13 and 22-53 was usedd. Big thankssss to both of youuuu!!! Now i can detect 40 digital sensorss.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |