Advertisement
Guest User

Untitled

a guest
Feb 27th, 2017
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.67 KB | None | 0 0
  1. /*
  2.     Autor: Lendwai
  3.     Name: LedLeuchtenKontrolle
  4.     Datum: 27.2.2017
  5.     ----------------------------------------
  6.     History:
  7.     ----------------------------------------
  8.     Programmbeschreibung:
  9. */
  10. int input = 0;
  11. float pwm = 0.0;
  12. int intpwm = 0;
  13. float dc = 0.0;
  14. void setup() {
  15.   Serial.begin(9600);
  16. }
  17.  
  18. void loop() {
  19.   input = analogRead(A0);
  20.   pwm = input / 4;
  21.   dc = pwm / 255;
  22.   dc = dc * 100;
  23.   intpwm = pwm;
  24.   Serial.print("Input:");
  25.   Serial.print(input);
  26.   Serial.print(" ");
  27.   Serial.print("PWM:");
  28.   Serial.print(intpwm);
  29.   Serial.print(" ");
  30.   Serial.print("DC:");
  31.   Serial.print(dc);
  32.   Serial.print("%");
  33.   Serial.println();
  34.   delay(500);
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement