collapse

* Posts Recentes

O que é isto ? por SerraCabo
[12 de Abril de 2024, 14:20]


Amplificador - Rockboard HA 1 In-Ear por almamater
[11 de Abril de 2024, 20:46]


Emulador NES em ESP32 por dropes
[10 de Abril de 2024, 15:30]


Meu novo robô por josecarlos
[29 de Março de 2024, 18:30]


Bateria - Portátil por almamater
[25 de Março de 2024, 22:14]


Escolher Osciloscópio por jm_araujo
[06 de Fevereiro de 2024, 23:07]


TP4056 - Dúvida por dropes
[31 de Janeiro de 2024, 14:13]


Leitura de dados por Porta Serie por jm_araujo
[22 de Janeiro de 2024, 14:00]


Distancia Cabo por jm_araujo
[08 de Janeiro de 2024, 16:30]


Laser Engraver - Alguém tem? por almamater
[16 de Dezembro de 2023, 14:23]

Autor Tópico: Exemplo-VirtualBreadboard  (Lida 4212 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.