Go Down

Topic: Writing on ports (Updated) (Read 89 times) previous topic - next topic

NewbieArduino

Jul 12, 2018, 03:51 pm Last Edit: Jul 12, 2018, 04:05 pm by NewbieArduino
I need to write values on PORTD and is given below
Code: [Select]

unsigned char value = 0;

void setup(){
DDRD = 0xFF;
}

void loop(){
value = value + 1;
PORTD = value;
}

Output:
Displaying BCD value 1, 3, 7 ... instead of 1,2,3,4...



Delta_G

That should only ever show a 1.  value never changes. 
|| | ||| | || | ||  ~Woodstock

Please do not PM with technical questions or comments.  Keep Arduino stuff out on the boards where it belongs.

PaulS

Quote
Output:
Displaying BCD value 1, 3, 7 ... instead of 1,2,3,4...
If that is your real code, the output should be 1. The value in the poorly named variable never changes.
The art of getting good answers lies in asking good questions.

NewbieArduino

Sorry I have updated the code

PaulS

What is connected to port D?
The art of getting good answers lies in asking good questions.

NewbieArduino


PaulS

What happens if you put a delay() in the loop()?
The art of getting good answers lies in asking good questions.

Go Up