Show Posts
Pages: 1 [2] 3 4
16  Using Arduino / Programming Questions / Newbie Scetch help on: March 24, 2011, 02:30:46 am
Good day

Please help me fix this code to maker it compile & work.

I get the following error when I compile my scetch: "ISO C++ forbids comparison between pointer and integer"

Here is the scetch:

Code:
int command = 0 ;

void setup() {
  // put your setup code here, to run once:
  delay(1000);          // wait a bit before starting
  Serial.begin(115200);   // set up Serial library at 9600 bps
}

void loop() {
  // put your main code here, to run repeatedly:
    if (Serial.available() > 0) {
    command = Serial.read();
    if (command == "1")
//pan left
    if (command == "2")
//pan center
    if (command == "3")
//pan right
    if (command == "4")
//tilt up
    if (command == "5")
//tilt center
    if (command == "6")
//tilt down
   
    command = 0; 
}
}

The error is displayed first on the following line:  if (command == "1")
17  Using Arduino / Interfacing w/ Software on the Computer / Re: Interfacing with AutoHotkey (Easy GUI's on Windows & Linux) on: March 16, 2011, 01:38:32 am
Good day

Is it possible to do this for two servos, pan and tilt.
I have been strugling to control two servos with buttons (UP/DOWN/LEFT/RIGHT)in C#, C++ or VB, but with no luck.
I would rely appreciate it if you can help me with this, even if it is sliders for two servos.
Or if you know of a website with source code & scetch to control 2 servo's, please let me know.

Thank you & regards,
Riaan Deyzel
18  Using Arduino / Interfacing w/ Software on the Computer / Re: C++ Servo Control from Windows, need some help on: March 13, 2011, 10:51:34 am
Good day

I would like the Arduino to keep track of the servo movements.
I use a standard Power HB 3001HB servo that moves only 180 degrees.
I also use an Arduino Deumilanueve and on the PC windows 7 Pro.
My goal is to pan & tilt two servo's, one on pin D9 & the other on D10.
I use Visual Studio 2008 Standard, I think it supports C# VB and C++,
So source in any one of theese will be appreciated.
19  Using Arduino / Interfacing w/ Software on the Computer / Re: C++ Servo Control from Windows, need some help on: March 11, 2011, 01:57:24 pm
Hi Paul

Yes button 1,2,3 are the 3 control buttons.
1, Left
2, Right
3, Center

Would like to move the servo about 5 to 10 degrees every time I click the
Buttons 1 & 2 and move to 180 when I press Center.
20  Using Arduino / Interfacing w/ Software on the Computer / Re: Arduino VB or C# servo control on: March 11, 2011, 02:20:39 am
Please note that I have now moved this Post to this link http://arduino.cc/forum/index.php/topic,54994.0.html, as I no longer use C# or VB to control a servo,  I now use C++ in Windows, and got it working to an certain extent.

I Still need help on this new Post Please
21  Using Arduino / Interfacing w/ Software on the Computer / Re: C++ Servo Control from Windows, need some help on: March 11, 2011, 02:16:19 am
Good day

In the link below It will show the example picture of the buttons that I am using tho control a servo on PinD9.
Included in this link will be link to download the C++ Source files (Arduino_Pin_Controlnew.rar) with The Arduino Scetch included:
http://robotcontrol.yolasite.com/ardiuno-stuff.php

I am still a newebie, and has tried to make a servo move with buttons now for about 6 months, as I know very little about programing, and Servo's jitter too much with Firmata, so I would like to use this C++ app.

Please help me make this app & source work correctly.
22  Using Arduino / Interfacing w/ Software on the Computer / Re: C++ Servo Control from Windows, need some help on: March 11, 2011, 02:00:12 am
C++ Source Code

Code:
#pragma once


namespace ArduinoPinControl {

using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;

/// <summary>
/// Summary for Form1
///
/// WARNING: If you change the name of this class, you will need to change the
///          'Resource File Name' property for the managed resource compiler tool
///          associated with all .resx files this class depends on.  Otherwise,
///          the designers will not be able to interact properly with localized
///          resources associated with this form.
/// </summary>
public ref class Form1 : public System::Windows::Forms::Form
{
public:
Form1(void)
{
InitializeComponent();
//
//TODO: Add the constructor code here
//
}

protected:
/// <summary>
/// Clean up any resources being used.
/// </summary>
~Form1()
{
if (components)
{
delete components;
}
}
private: System::IO::Ports::SerialPort^  serialPort1;
protected:
private: System::Windows::Forms::Button^  button1;
private: System::Windows::Forms::Button^  button2;
private: System::Windows::Forms::Button^  button3;
private: System::Windows::Forms::Label^  label1;






private: System::ComponentModel::IContainer^  components;

private:
/// <summary>
/// Required designer variable.
/// </summary>


#pragma region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
void InitializeComponent(void)
{
this->components = (gcnew System::ComponentModel::Container());
this->serialPort1 = (gcnew System::IO::Ports::SerialPort(this->components));
this->button1 = (gcnew System::Windows::Forms::Button());
this->button2 = (gcnew System::Windows::Forms::Button());
this->button3 = (gcnew System::Windows::Forms::Button());
this->label1 = (gcnew System::Windows::Forms::Label());
this->SuspendLayout();
//
// serialPort1
//
this->serialPort1->PortName = L"COM3";
//
// button1
//
this->button1->Location = System::Drawing::Point(3, 37);
this->button1->Name = L"button1";
this->button1->Size = System::Drawing::Size(75, 63);
this->button1->TabIndex = 0;
this->button1->Text = L"LEFT";
this->button1->UseVisualStyleBackColor = true;
this->button1->Click += gcnew System::EventHandler(this, &Form1::button1_Click);
//
// button2
//
this->button2->Location = System::Drawing::Point(105, 37);
this->button2->Name = L"button2";
this->button2->Size = System::Drawing::Size(75, 63);
this->button2->TabIndex = 1;
this->button2->Text = L"CENTER";
this->button2->UseVisualStyleBackColor = true;
this->button2->Click += gcnew System::EventHandler(this, &Form1::button2_Click_1);
//
// button3
//
this->button3->Location = System::Drawing::Point(206, 37);
this->button3->Name = L"button3";
this->button3->Size = System::Drawing::Size(68, 63);
this->button3->TabIndex = 2;
this->button3->Text = L"RIGHT";
this->button3->UseVisualStyleBackColor = true;
this->button3->Click += gcnew System::EventHandler(this, &Form1::button3_Click);
//
// label1
//
this->label1->AutoSize = true;
this->label1->Location = System::Drawing::Point(0, 21);
this->label1->Name = L"label1";
this->label1->Size = System::Drawing::Size(95, 13);
this->label1->TabIndex = 3;
this->label1->Text = L"ARDUINO PIN D9";
this->label1->Click += gcnew System::EventHandler(this, &Form1::label1_Click);
//
// Form1
//
this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
this->ClientSize = System::Drawing::Size(298, 133);
this->Controls->Add(this->label1);
this->Controls->Add(this->button3);
this->Controls->Add(this->button2);
this->Controls->Add(this->button1);
this->Name = L"Form1";
this->Text = L"ARDUINO DUAL SERVO CONTROL";
this->ResumeLayout(false);
this->PerformLayout();

}
#pragma endregion
private: System::Void button1_Click(System::Object^  sender, System::EventArgs^  e)
    {
      this->serialPort1->PortName = "COM3";  // Replace with your COM port!
      this->serialPort1->Open();
      this->serialPort1->Write( "1" );  // In the future,  you'll expand on this
                                        // to write your custom data to the board
      this->serialPort1->Close();
}
private: System::Void button2_Click(System::Object^  sender, System::EventArgs^  e) {
}
private: System::Void button2_Click_1(System::Object^  sender, System::EventArgs^  e) {
      this->serialPort1->PortName = "COM3";  // Replace with your COM port!
      this->serialPort1->Open();
      this->serialPort1->Write( "2" );  // In the future,  you'll expand on this
                                        // to write your custom data to the board
      this->serialPort1->Close();

}
private: System::Void button3_Click(System::Object^  sender, System::EventArgs^  e) {
      this->serialPort1->PortName = "COM3";  // Replace with your COM port!
      this->serialPort1->Open();
      this->serialPort1->Write( "3" );  // In the future,  you'll expand on this
                                        // to write your custom data to the board
      this->serialPort1->Close();
}
private: System::Void button6_Click(System::Object^  sender, System::EventArgs^  e) {
}
private: System::Void label2_Click(System::Object^  sender, System::EventArgs^  e) {
}
private: System::Void label1_Click(System::Object^  sender, System::EventArgs^  e) {
}
};
}

23  Using Arduino / Interfacing w/ Software on the Computer / C++ Servo Control from Windows, need some help on: March 11, 2011, 01:58:08 am
Good day
 I have mannaged to create a C++ app that controls a servo from left to right.
There are three buttons LEFT, CENTER & RIGHT.
At the moment there is something strange going on with my scetch, It does nothing when I press LEFT, and moves right when I click CENTER & when I click RIGHT, I would like it to do what the buttons says.
I have struggled with this until about 11PM last night, and I just can not get it right.
I am attatching the Scetch, C++ Source Code and a link to download the C++ source files with attatched Scetch.
I figure there is something wrong with my IF statements, but have no idea to fix it.

Arduino Scetch
Code:
/*
 
* Serial Read Blink
 * -----------------
 * Turns a Servo connected to digital pin 9.
 * The Servo will move the number of times given by a
 * ASCII number read from the serial port.
 *
 * Created 11 March 2011
 * copyleft 2006 Tod E. Kurt <tod@todbot.com>
 * http://todbot.com/
 * Edited by Riaan Deyzel
 * based on "serial_read_advanced" example
 */

int ServoPin = 9; 
int val = 1;       

void setup() {
  pinMode(ServoPin,OUTPUT);   
  Serial.begin(9600);       
}

void loop () {
  val = Serial.read();     

 
  if (val > '1' && val <= '600' ) {
    val = val - '0';         
    for(int i=0; i<=val; i++) {
      Serial.println("Move!");
      digitalWrite(ServoPin,HIGH);
      delay(15);
      digitalWrite(ServoPin, LOW);
      delay(15);
    }
    //Serial.println();
  }
}

24  Using Arduino / Interfacing w/ Software on the Computer / Re: Arduino VB or C# servo control on: March 10, 2011, 09:07:02 am
C++ Code:

Code:
#pragma once


namespace ArduinoPinControl {

using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;

/// <summary>
/// Summary for Form1
///
/// WARNING: If you change the name of this class, you will need to change the
///          'Resource File Name' property for the managed resource compiler tool
///          associated with all .resx files this class depends on.  Otherwise,
///          the designers will not be able to interact properly with localized
///          resources associated with this form.
/// </summary>
public ref class Form1 : public System::Windows::Forms::Form
{
public:
Form1(void)
{
InitializeComponent();
//
//TODO: Add the constructor code here
//
}

protected:
/// <summary>
/// Clean up any resources being used.
/// </summary>
~Form1()
{
if (components)
{
delete components;
}
}
private: System::IO::Ports::SerialPort^  serialPort1;
protected:
private: System::Windows::Forms::Button^  button1;
private: System::Windows::Forms::Button^  button2;
private: System::Windows::Forms::Button^  button3;
private: System::Windows::Forms::Label^  label1;
private: System::Windows::Forms::Button^  button4;
private: System::Windows::Forms::Button^  button5;
private: System::Windows::Forms::Button^  button6;
private: System::Windows::Forms::Label^  label2;


private: System::ComponentModel::IContainer^  components;

private:
/// <summary>
/// Required designer variable.
/// </summary>


#pragma region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
void InitializeComponent(void)
{
this->components = (gcnew System::ComponentModel::Container());
this->serialPort1 = (gcnew System::IO::Ports::SerialPort(this->components));
this->button1 = (gcnew System::Windows::Forms::Button());
this->button2 = (gcnew System::Windows::Forms::Button());
this->button3 = (gcnew System::Windows::Forms::Button());
this->label1 = (gcnew System::Windows::Forms::Label());
this->button4 = (gcnew System::Windows::Forms::Button());
this->button5 = (gcnew System::Windows::Forms::Button());
this->button6 = (gcnew System::Windows::Forms::Button());
this->label2 = (gcnew System::Windows::Forms::Label());
this->SuspendLayout();
//
// serialPort1
//
this->serialPort1->PortName = L"COM17";
//
// button1
//
this->button1->Location = System::Drawing::Point(3, 37);
this->button1->Name = L"button1";
this->button1->Size = System::Drawing::Size(75, 63);
this->button1->TabIndex = 0;
this->button1->Text = L"LEFT";
this->button1->UseVisualStyleBackColor = true;
this->button1->Click += gcnew System::EventHandler(this, &Form1::button1_Click);
//
// button2
//
this->button2->Location = System::Drawing::Point(199, 37);
this->button2->Name = L"button2";
this->button2->Size = System::Drawing::Size(75, 63);
this->button2->TabIndex = 1;
this->button2->Text = L"RIGHT";
this->button2->UseVisualStyleBackColor = true;
this->button2->Click += gcnew System::EventHandler(this, &Form1::button2_Click_1);
//
// button3
//
this->button3->Location = System::Drawing::Point(105, 37);
this->button3->Name = L"button3";
this->button3->Size = System::Drawing::Size(68, 63);
this->button3->TabIndex = 2;
this->button3->Text = L"CENTER";
this->button3->UseVisualStyleBackColor = true;
this->button3->Click += gcnew System::EventHandler(this, &Form1::button3_Click);
//
// label1
//
this->label1->AutoSize = true;
this->label1->Location = System::Drawing::Point(0, 21);
this->label1->Name = L"label1";
this->label1->Size = System::Drawing::Size(95, 13);
this->label1->TabIndex = 3;
this->label1->Text = L"ARDUINO PIN D9";
this->label1->Click += gcnew System::EventHandler(this, &Form1::label1_Click);
//
// button4
//
this->button4->ForeColor = System::Drawing::SystemColors::ControlDark;
this->button4->Location = System::Drawing::Point(105, 140);
this->button4->Name = L"button4";
this->button4->Size = System::Drawing::Size(68, 60);
this->button4->TabIndex = 6;
this->button4->Text = L"CENTER";
this->button4->UseVisualStyleBackColor = true;
//
// button5
//
this->button5->ForeColor = System::Drawing::SystemColors::ControlDark;
this->button5->Location = System::Drawing::Point(199, 140);
this->button5->Name = L"button5";
this->button5->Size = System::Drawing::Size(75, 60);
this->button5->TabIndex = 5;
this->button5->Text = L"DOWN";
this->button5->UseVisualStyleBackColor = true;
//
// button6
//
this->button6->ForeColor = System::Drawing::SystemColors::ControlDark;
this->button6->Location = System::Drawing::Point(3, 140);
this->button6->Name = L"button6";
this->button6->Size = System::Drawing::Size(75, 60);
this->button6->TabIndex = 4;
this->button6->Text = L"UP";
this->button6->UseVisualStyleBackColor = true;
this->button6->Click += gcnew System::EventHandler(this, &Form1::button6_Click);
//
// label2
//
this->label2->AutoSize = true;
this->label2->ForeColor = System::Drawing::SystemColors::ButtonShadow;
this->label2->Location = System::Drawing::Point(0, 124);
this->label2->Name = L"label2";
this->label2->Size = System::Drawing::Size(101, 13);
this->label2->TabIndex = 7;
this->label2->Text = L"ARDUINO PIN D10";
this->label2->Click += gcnew System::EventHandler(this, &Form1::label2_Click);
//
// Form1
//
this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
this->ClientSize = System::Drawing::Size(298, 212);
this->Controls->Add(this->label2);
this->Controls->Add(this->button4);
this->Controls->Add(this->button5);
this->Controls->Add(this->button6);
this->Controls->Add(this->label1);
this->Controls->Add(this->button3);
this->Controls->Add(this->button2);
this->Controls->Add(this->button1);
this->Name = L"Form1";
this->Text = L"ARDUINO DUAL SERVO CONTROL";
this->ResumeLayout(false);
this->PerformLayout();

}
#pragma endregion
private: System::Void button1_Click(System::Object^  sender, System::EventArgs^  e)
    {
      this->serialPort1->PortName = "COM17";  // Replace with your COM port!
      this->serialPort1->Open();
      this->serialPort1->Write( "1" );  // In the future,  you'll expand on this
                                        // to write your custom data to the board
      this->serialPort1->Close();
}
private: System::Void button2_Click(System::Object^  sender, System::EventArgs^  e) {
}
private: System::Void button2_Click_1(System::Object^  sender, System::EventArgs^  e) {
      this->serialPort1->PortName = "COM17";  // Replace with your COM port!
      this->serialPort1->Open();
      this->serialPort1->Write( "2" );  // In the future,  you'll expand on this
                                        // to write your custom data to the board
      this->serialPort1->Close();

}
private: System::Void button3_Click(System::Object^  sender, System::EventArgs^  e) {
      this->serialPort1->PortName = "COM17";  // Replace with your COM port!
      this->serialPort1->Open();
      this->serialPort1->Write( "3" );  // In the future,  you'll expand on this
                                        // to write your custom data to the board
      this->serialPort1->Close();
}
private: System::Void button6_Click(System::Object^  sender, System::EventArgs^  e) {
}
private: System::Void label2_Click(System::Object^  sender, System::EventArgs^  e) {
}
private: System::Void label1_Click(System::Object^  sender, System::EventArgs^  e) {
}
};
}



Thank you very much for the help so far, I would like to test this code tonight, and hope to move a servo left to right and center it.
25  Using Arduino / Interfacing w/ Software on the Computer / Re: Arduino VB or C# servo control on: March 10, 2011, 09:06:09 am
Thanks PaulS for your input so far, you do contribute very valueble information, and you definitely know alot about coding and hardware.
I realy do appreciate it.
Please note that I have now created 3 more buttuns for a second servo, but they are not coded in yet to do anything, so  ignore buttons 4 through 6 in the C++ Code.

Revised Scetch:
 
Code:
/*
 * Serial Read Servo
 * -----------------
 * Moves a Servo connected to digital pin 9.
 * The Servo will move the number given by a
 * ASCII number read from the serial port.
 * One Servo with two buttons (Pan Left & Pan Right)
 * Created 10 March 2011
 */

int Servo1 = 9;                  // select the pin for Servo1
int val = 0;                        // variable to store the data from the serial port

void setup() {
pinMode(Servo1,OUTPUT);    // declare Servo1 pin as output
Serial.begin(9600);              // connect to the serial port
}
void loop () {
val = Serial.read();              // read the serial port

if (val > '1' && val <= '180' )   //Button1 Pan Left represented by a '1'
if (val > '2' && val <= '180' )   //Button2 Pan Right represented by a '2'
if (val > '3' && val == '90' )    //Button3 Center represented by a '3'

val = val - '1';                      //Read Value from Button1 converted from character to number
val = val - '2';                      //Read Value from Button2 converted from character to number
val = val - '3';                      //Read Value from Button3 converted from character to number

for(int i=1; i<val; i++)           //Button1 Pan Left
for(int i=2; i<val; i++)           //button2 Pan Right
for(int i=3; i<val; i++)           //button3 Center

Serial.println("MOVE!");         //message to display in Serial Monitor
digitalWrite(Servo1,val);        //Write Value to Servo1
delay(15);                           //Delay for Servo1
Serial.flush();                      //Flush Serial Data, to prevent intermittent movement of servo
return;
}
26  Using Arduino / Interfacing w/ Software on the Computer / Re: Arduino VB or C# servo control on: March 10, 2011, 03:55:25 am
Here is my C++ Code & Screensot of my Goal:

Code:
#pragma once


namespace ArduinoPinControl {

using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;

/// <summary>
/// Summary for Form1
///
/// WARNING: If you change the name of this class, you will need to change the
///          'Resource File Name' property for the managed resource compiler tool
///          associated with all .resx files this class depends on.  Otherwise,
///          the designers will not be able to interact properly with localized
///          resources associated with this form.
/// </summary>
public ref class Form1 : public System::Windows::Forms::Form
{
public:
Form1(void)
{
InitializeComponent();
//
//TODO: Add the constructor code here
//
}

protected:
/// <summary>
/// Clean up any resources being used.
/// </summary>
~Form1()
{
if (components)
{
delete components;
}
}
private: System::IO::Ports::SerialPort^  serialPort1;
protected:
private: System::Windows::Forms::Button^  button1;
private: System::Windows::Forms::Button^  button2;
private: System::Windows::Forms::Button^  button3;


private: System::ComponentModel::IContainer^  components;

private:
/// <summary>
/// Required designer variable.
/// </summary>


#pragma region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
void InitializeComponent(void)
{
this->components = (gcnew System::ComponentModel::Container());
this->serialPort1 = (gcnew System::IO::Ports::SerialPort(this->components));
this->button1 = (gcnew System::Windows::Forms::Button());
this->button2 = (gcnew System::Windows::Forms::Button());
this->button3 = (gcnew System::Windows::Forms::Button());
this->SuspendLayout();
//
// serialPort1
//
this->serialPort1->PortName = L"COM17";
//
// button1
//
this->button1->Location = System::Drawing::Point(3, 37);
this->button1->Name = L"button1";
this->button1->Size = System::Drawing::Size(75, 23);
this->button1->TabIndex = 0;
this->button1->Text = L"Left";
this->button1->UseVisualStyleBackColor = true;
this->button1->Click += gcnew System::EventHandler(this, &Form1::button1_Click);
//
// button2
//
this->button2->Location = System::Drawing::Point(148, 37);
this->button2->Name = L"button2";
this->button2->Size = System::Drawing::Size(75, 23);
this->button2->TabIndex = 1;
this->button2->Text = L"Right";
this->button2->UseVisualStyleBackColor = true;
this->button2->Click += gcnew System::EventHandler(this, &Form1::button2_Click_1);
//
// button3
//
this->button3->Location = System::Drawing::Point(85, 37);
this->button3->Name = L"button3";
this->button3->Size = System::Drawing::Size(57, 23);
this->button3->TabIndex = 2;
this->button3->Text = L"Center";
this->button3->UseVisualStyleBackColor = true;
this->button3->Click += gcnew System::EventHandler(this, &Form1::button3_Click);
//
// Form1
//
this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
this->ClientSize = System::Drawing::Size(225, 99);
this->Controls->Add(this->button3);
this->Controls->Add(this->button2);
this->Controls->Add(this->button1);
this->Name = L"Form1";
this->Text = L"Arduino Control";
this->ResumeLayout(false);

}
#pragma endregion
private: System::Void button1_Click(System::Object^  sender, System::EventArgs^  e)
    {
      this->serialPort1->PortName = "COM17";  // Replace with your COM port!
      this->serialPort1->Open();
      this->serialPort1->Write( "0" );  // In the future,  you'll expand on this
                                        // to write your custom data to the board
      this->serialPort1->Close();
}
private: System::Void button2_Click(System::Object^  sender, System::EventArgs^  e) {
}
private: System::Void button2_Click_1(System::Object^  sender, System::EventArgs^  e) {
      this->serialPort1->PortName = "COM17";  // Replace with your COM port!
      this->serialPort1->Open();
      this->serialPort1->Write( "00" );  // In the future,  you'll expand on this
                                        // to write your custom data to the board
      this->serialPort1->Close();

}
private: System::Void button3_Click(System::Object^  sender, System::EventArgs^  e) {
      this->serialPort1->PortName = "COM17";  // Replace with your COM port!
      this->serialPort1->Open();
      this->serialPort1->Write( "000" );  // In the future,  you'll expand on this
                                        // to write your custom data to the board
      this->serialPort1->Close();
}
};
}



Screenshot: http://robotcontrol.yolasite.com/ardiuno-stuff.php

Please help with this, as I am still a newbie to the Arduino & code.
27  Using Arduino / Interfacing w/ Software on the Computer / Re: Arduino VB or C# servo control on: March 10, 2011, 01:01:05 am
Good day

Will the following code work to control a servo conected to Digital Pin9?
I am planning to copy the C++ Button & create another button, but just changing the value sent to '00'.
Code:
/*
 * Serial Read Servo
 * -----------------
 * Moves a Servo connected to digital pin 9.
 * The Servo will move the number given by a
 * ASCII number read from the serial port.
 * One Servo with two buttons (Pan Left & Pan Right)
 * Created 10 March 2011
 */

int Servo1 = 9;    // select the pin for Servo1
int val = 0;       // variable to store the data from the serial port

void setup() {
pinMode(Servo1,OUTPUT);    // declare Servo1 pin as output
Serial.begin(9600);        // connect to the serial port
}
void loop () {
val = Serial.read();      // read the serial port

if (val > '0' && val <= '180' )  //Button1 Pan Left represented by a '0'
if (val > '00' && val <= '180' ) //Button2 Pan Right represented by a '00'
val = val - '0';                 //Read Value from Button1
val = val - '00';                //Read Value from Button2
for(int i=0; i<val; i++)         //Button1 Pan Left
for(int i=00; i<val; i++)        //button2 Pan Right

Serial.println("MOVE!");         //message to display in Serial Monitor
digitalWrite(Servo1,val);
delay(15);
}

Feel free to input any sugestions.
28  Using Arduino / Interfacing w/ Software on the Computer / Re: Arduino VB or C# servo control on: March 09, 2011, 07:13:55 am
Hi, Thank you for the quick responce

Does that mean that I only need to change the scetch to perform the function, If so, anyone out the willing to try this please.I am reletavely new to the Programming world, and the link above is actualy the first app that I have ever written.

Thank you,
Riaan Deyzel
29  Using Arduino / Interfacing w/ Software on the Computer / Re: Arduino VB or C# servo control on: March 09, 2011, 07:03:55 am
Good day

I have managed to get a C++ app working, turning the led on pin 13 on and off.
Follow this link for example: http://arduino.cc/playground/Interfacing/CPPWindows, but i would now like to use the same button to make a servo move about 10 degrees every time i click the button.
Please give me some input on this, or links to similar C++ or C# apps. 
30  Using Arduino / Interfacing w/ Software on the Computer / Re: Arduino VB or C# servo control on: March 02, 2011, 01:47:26 pm
I would like to click on momentary buttons, every click makes it move 10 degrees.
Exactly like this project, but only adding support for another servo (servo on pin D9 & D10) http://blog.renatopeterman.com.br/?p=164 and in english if possibe.
I do not have any programming knowlege, so would really appreciate it if anyone could send me the modified source, or a similar pan tilt project source someone might have done to pan and tilt two servos via arduino.

Please help with thIis, I have tried this now for about 6 months now.

Thank you
Pages: 1 [2] 3 4