Advertisement
safwan092

Untitled

Jun 8th, 2023
16
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. //Arduino Uno, PWM output is possible on digital I/O pins 3, 5, 6, 9, 10 and 11.
  2.  
  3. #define pwmPinOutput 11
  4.  
  5. float voltageNeededToOutput = 1.798;
  6. float analogPWMoutput = 0;
  7. void setup() {
  8. Serial.begin(9600);
  9. pinMode(pwmPinOutput, OUTPUT);
  10. }
  11.  
  12. void loop() {
  13. analogPWMoutput = map(voltageNeededToOutput, 0, 5, 0, 255);
  14. analogWrite(pwmPinOutput, analogPWMoutput);
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement