I am new to Arduino, I have to write a program in C language to switch on and off (0.5 s delay) an LED connected to pin 10 in ARDUINO. Use the address of 328p and verify the code on the ARDUINO board. Please can you help.
Make a few changes to the Blink example and you're there
yes I am
can you write the code
Yes, YOU do. Here is some help:
IDE >> FILE >> EXAMPLES >> BUILT-IN EXAMPLES
please explain what is it I am new to forum
when I write code
void setup {
pinMode (10, OUTPUT);
}
void loop() {
digitalWrite (led, LOW);
delay(500); // wait for 0.5 s
digitalWrite (led, HIGH);
delay(500);
}
I have error 'led' was not declared in this scope
You need to learn.
You copied the program wrong.
what is wrong please help
@zyraf30 ,
Your topic was moved to its current location as it is more suitable.
Could you also take a few moments to Learn How To Use The Forum.
It will help you get the best out of the forum in the future.
Thank you
You did not declare the variable led
which needs to be done before you can use it anywhere in your code. Since your LED is connected to pin 10, the variable led
should contain that value. Also, since this variable never changes, you can tell the compiler that it is a constant.
const int led = 10; // pin 10
void setup {
pinMode (led, OUTPUT);
}
void loop() {
digitalWrite (led, LOW);
delay(500); // wait for 0.5 s
digitalWrite (led, HIGH);
delay(500);
}
thanks is working
How about Write a program in assembly language to move 12 bytes of data from memory address 100$ to $200. Then, replace the 12 bytes of data at $ with zeros.
Is this the second part of your homework?
The Arduino does not work with direct addresses, they must be declared as arrays.
Did you put a resistor in series with the LED for part 1 of your homework?
I hope we get full credit when you submit this stuff as your own work.
no I have to writhe a program in assembly language. Grumpy_Mike you the best
yes it is second part my homework it is very hard for me I am taking classes online is not easy
So you'd rather just plagiarize instead of attempt to learn? I hope you fail the class.
You did not copy the whole program.
How I can learn this quick