materials for TeZ Bioreactor course
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

37 lines
704 B

// WEMOS D1 MINI ESP32 // MOTOR TEST (with TIP 120) // TeZ 2022
#include <Arduino.h>
#include <analogWrite.h>
#define MOTORPIN 26
int powerStep = 1;
int power = 0;
/////////////////////////////////////////
void setup() {
// Set resolution for a specific pin
analogWriteResolution(MOTORPIN, 12);
for(int n=0; n<3; n++){
analogWrite(MOTORPIN, 200);
digitalWrite(2,HIGH);
delay(500);
analogWrite(MOTORPIN, 0);
digitalWrite(2,LOW);
delay(500);
}
}
/////////////////////////////////////////
void loop() {
power += powerStep;
if ( power == 0 || power == 255 ) {
powerStep = -powerStep;
}
analogWrite(MOTORPIN, power);
analogWrite(2, power);
delay(10);
}