Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. PImage fondo;
  2. int temperatura = 0;
  3. int humedad = 0;
  4. int iluminacion = 0;
  5.  
  6. void setup() {
  7.   size(400, 400);
  8.   fondo = loadImage("higrometro.jpg");
  9. }
  10.  
  11. void draw() {
  12.   background(255);
  13.   image(fondo, 0, 0);
  14.   drawTemp(temperatura);
  15.   drawHumedad(humedad);
  16.   drawIluminacion(iluminacion);
  17. }
  18.  
  19. void drawTemp(float temp)
  20. {
  21. }
  22.  
  23. void drawHumedad(float hum)
  24. {
  25.   int cx = 200, cy = 206, radio = 150;
  26.   // la humedad va de 0% a 100%
  27.   float angulo = map(hum, 0, 100, -240, 60) * (PI/180);
  28.   stroke(255);
  29.   strokeWeight(4);
  30.   line(cx, cy, cx + cos(angulo) * radio, cy + sin(angulo) * radio);
  31. }
  32.  
  33. void drawIluminacion(float ilum)
  34. {
  35. }