collapse

* Posts Recentes

+ LASERs por dropes
[03 de Julho de 2025, 19:35]


Cerca eléctrica por SerraCabo
[14 de Junho de 2025, 23:26]


Alguém arranja motores? por almamater
[10 de Junho de 2025, 22:34]


Condensador 4.7uF 0603 por brunus
[09 de Junho de 2025, 15:52]


Lenovo IdeaPad 3 Não liga por jm_araujo
[07 de Maio de 2025, 19:10]


Identificar Diodo Zenner por filjoa
[01 de Maio de 2025, 23:07]


Meu novo robô por dropes
[18 de Março de 2025, 14:51]


JBL partybox On-The-Go por almamater
[21 de Fevereiro de 2025, 23:32]


Talking Reverse Engineering with an Absolute Legend! por SerraCabo
[13 de Fevereiro de 2025, 09:56]


Motoserra Stihl 120C por brunus
[11 de Fevereiro de 2025, 16:29]

Autor Tópico: Exemplo-VirtualBreadboard  (Lida 6862 vezes)

0 Membros e 1 Visitante estão a ver este tópico.

Offline kerwac

  • Mini Robot
  • *
  • Mensagens: 101
Exemplo-VirtualBreadboard
« em: 20 de Abril de 2010, 15:29 »
Como tinha referido à uns dias atrás aqui deixo um exemplo de um programa feito com o VirtualBreadboard.
Codigo:
class Sweep extends com.muvium.compatibility.arduino.Arduino{//Automatically Added VBB Framework Code - do not remove
   // Controlling a servo position using a potentiometer (variable resistor)
   // Kerwac

   #include <Servo.h>
 
   Servo myservo9;  // create servo object to control a servo
   Servo myservo10;  // create servo object to control a servo
 
   int potpin9 = 0;  // analog pin used to connect the potentiometer
   int potpin10 = 1;  // analog pin used to connect the potentiometer
   int val;    // variable to read the value from the analog pin
 
   void setup()
   {
      myservo9.attach(9);  // attaches the servo on pin 9 to the servo object
      myservo10.attach(10);  // attaches the servo on pin 9 to the servo object
   }
 
   void loop()
   {
      val = analogRead(potpin9);            // reads the value of the potentiometer (value between 0 and 1023)
      val = map(val, 0, 1023, 0, 179);     // scale it to use it with the servo (value between 0 and 180)
      myservo9.write(val);                  // sets the servo position according to the scaled value
      
      val = analogRead(potpin10);            // reads the value of the potentiometer (value between 0 and 1023)
      val = map(val, 0, 1023, 0, 179);     // scale it to use it with the servo (value between 0 and 180)
      myservo10.write(val);                  // sets the servo position according to the scaled value
      
 
      delay(15);                           // waits for the servo to get there
   }
 
}
Podemos não voltar.Mas vamos a todas.

Offline amando96

  • Mini Robot
  • *
  • Mensagens: 1.631
  • MAC address? But I have windows...
    • Projects, News, Blog, Tutorials
Re: Exemplo-VirtualBreadboard
« Responder #1 em: 20 de Abril de 2010, 19:22 »
Não podes usar a hypercam para vermos a simulação no pc? ou uma print screen?

Offline kerwac

  • Mini Robot
  • *
  • Mensagens: 101
Re: Exemplo-VirtualBreadboard
« Responder #2 em: 20 de Abril de 2010, 21:56 »
Como faço isso aqui no forum?
já tentei por um video mas algo correu mal.
Tens uma imagem em anexo das ligaçoes.
É muito simples trabalhar com este programa.Qualquer coisa que precises diz.Eu ajudo
Podemos não voltar.Mas vamos a todas.