Advertisement
safwan092

Untitled

Jun 8th, 2023
21
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 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 = 0.549;//1.798;
  6. float analogPWMoutput = 0;
  7. void setup() {
  8. Serial.begin(9600);
  9. pinMode(pwmPinOutput, OUTPUT);
  10. }
  11.  
  12. void loop() {
  13. analogPWMoutput = ((voltageNeededToOutput*255.00)/(5.00));
  14. Serial.println(int(analogPWMoutput));
  15. analogWrite(pwmPinOutput, int(analogPWMoutput));
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement