Click here to Skip to main content
15,890,185 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hello world,
please can anyone help concerning my new code i wrote.I debug it using arduino and AVR studio 5.1 but i found it very difficult to run the code because it sees some error and warning in the code am using c as my programming language. and i would be glad if anyone can help me in correcting the error in it and making it to run am using atmega32u4 as my microcontroller and atmega328
.. The actual function of my code is to generate pwm for unipolar motor there is 0-7 pin at port A and i want two pins to go high at once delay for 250ms so i wrote the hex file for the two pins and that is 0x05,0x09,0x06,0x0A so the hex signify when the two pin are high together and it increment in step until the final step is reach and that is step 4 and a while loop start again and again. thanks i will really appreciate you assitance.

C++
/* pulse generated to control the pulse width modulation of 
unipolar motor.
*/

 #include<stdio.h>     
 
 }
  void setup() /*Beginning of the body of the program*/
                     
       int led =0;  /* start from the begining*/
       {
 int led_array_[4]=(0x05,0x09,0x06,0x0A) /* pins use as output*/

 void loop () 
 {
 p1=~led_array(led);
  delay (250);
   led++;
  if (led==4)led=0;
}
  }
  }


[edit]SHOUTING removed - OriginalGriff[/edit]
Posted
Updated 1-Jul-12 6:00am
v3
Comments
OriginalGriff 1-Jul-12 12:00pm    
DON'T SHOUT. Using all capitals is considered shouting on the internet, and rude (using all lower case is considered childish). Use proper capitalisation if you want to be taken seriously.
OriginalGriff 1-Jul-12 12:05pm    
Firstly, if you are going to use a high level language, learn to indent it. It makes it a lot easier to read
Secondly, if you are going to post a code fragment for us to explain, or help you with, make sure it compiles, or explain that teh errors are what you need help with.

That code fragment looks like you have grabbed a few bits from here and there which might be relevant, and expect us to sort it all out into working code.

Use the "Improve question" widget to edit your question and provide better information.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900