Search
 
SCRIPT & CODE EXAMPLE
 

C

arduino dont working dc motor

AF_DCMotor motor(1);

void setup() {
  Serial.begin(9600);           // set up Serial library at 9600 bps
  Serial.println("Motor test!");

  // turn on motor
  motor.setSpeed(200);

  motor.run(RELEASE);
}

void loop() {
  uint8_t i;

  Serial.print("tick");

  motor.run(FORWARD);
  for (i=0; i<255; i++) {
    motor.setSpeed(i);  
    delay(10);
 }

  for (i=255; i!=0; i--) {
    motor.setSpeed(i);  
    delay(10);
 }

  Serial.print("tock");

  motor.run(BACKWARD);
  for (i=0; i<255; i++) {
    motor.setSpeed(i);  
    delay(10);
 }

  for (i=255; i!=0; i--) {
    motor.setSpeed(i);  
    delay(10);
 }


  Serial.print("tech");
  motor.run(RELEASE);
  delay(1000);
}
Comment

PREVIOUS NEXT
Code Example
C :: linux_reboot_magic2 
C :: ansi c read write bmp 
C :: C/AL Convertion of Decimal to String/Text 
C :: allintext:christie kiser filetype:log 
C :: arduino internal pull up resistor 
C :: obstacle avoiding robot in c++ program 
C :: c program for calculating product of array 
C :: convert c to phyton 
C :: how to do Employing defensive code in the UI to ensure that the current frame is the most top level window 
C :: How to include multiline conditional inside template literal 
C :: create a gtk window 
C :: Combine two sentences into one langage c 
C :: hgggggggggggggggg 
C :: call cuda kernel from c parameters 
C :: clipboard lib 
C :: c to assembly converter online 
C :: __isoc99_sscanf 
C :: Algorithm that flips sentences and numbers 
C :: cut first part of string c 
C :: analog clock c code for turbo 
C :: wpdb add temporary while drop table 
C :: why return 0 is written at the code end? 
C :: Defining a macro in a header file 
C :: A string S is passed as the input. Two words W1 and W2 which are present in the string S are also passed as the input. The program must find the minimum distance D between W1 and W2 in S (in forward or reverse order) and print D as the output. 
C :: c pass two dimensional array to function 
C :: free array in c 
Dart :: round corner of alertdialog flutter 
Dart :: flutter sharedpreferences clear 
Dart :: multi dex flutter 
Dart :: waiting for another flutter command to release the startup lock 
ADD CONTENT
Topic
Content
Source link
Name
3+9 =