Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * ------------------------------------------
- * | |
- * | I need more POWER! |
- * | |
- * | learnelectronics |
- * | 16 June 2019 |
- * | |
- * | A look at using transistors |
- * | in your Arduino projects to |
- * | overcome the Arduino's 40mA |
- * | per pin current limit. |
- * | |
- * | www.youtube.com/c/learnelectronics |
- * | |
- * | [email protected] |
- * | |
- * ------------------------------------------
- */
- // Universal variables
- int vPow = 0;
- int bulb = 3;
- void setup() {
- Serial.begin(9600);
- pinMode(bulb, OUTPUT);
- }
- void loop() {
- int pot = analogRead(A0);
- vPow = map(pot,0,1023,0,255);
- Serial.print("raw=");
- Serial.println(pot);
- Serial.print("vPow=");
- Serial.println(vPow);
- analogWrite(bulb,vPow);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement