Show Posts
Pages: [1]
1  Development / Other Hardware Development / Arduino pro mini eagle files on: December 10, 2012, 06:39:01 am
Hi everyone, im searching "arduino pro mini" eagle files where is made full board for printing and making own board... in spurkfun and other sites where is "arduino pro mini" eagle files there boars are not full for printing, there is now GRN marked on sketch... so anyone can help me?
2  Using Arduino / Sensors / Re: ITG3200 gyro + Servo Motors on: May 22, 2012, 01:30:12 pm
Can you write example? Couse im new in arduino..
3  Using Arduino / Sensors / ITG3200 gyro + Servo Motors on: May 22, 2012, 06:57:35 am
Hi everyone, im playing with ITG3200 gyro and with that gyro i want to controll my servos but there is a problem... When im uploading my code to ATMega168 my 4 servos just twitches... So i dont know where is problem.. Wiring are good..


Code:
#include <Wire.h>
#include <ITG3200.h>
#include <Servo.h>
ITG3200 gyro = ITG3200();
float  x,y,z;
float angleServas1=0;
float angleServas2=0;
float angleServas3=0;
float angleServas4=0;
int ix, iy, iz;
unsigned long time_1=0;
unsigned long time_2=0;
Servo servas1;
Servo servas2;
Servo servas3;
Servo servas4;
int ServoPositionServo1;
int ServoPositionServo2;
int ServoPositionServo3;
int ServoPositionServo4;
void setup(void) {
  Serial.begin(9600);
  servas1.attach(8);
  servas2.attach(9);
  servas3.attach(10);
  servas4.attach(11);
  Wire.begin();      
  delay(100);
  servas1.write(0);
  servas2.write(0);
  servas3.write(0);
  servas4.write(0);
  gyro.init(ITG3200_ADDR_AD0_HIGH);
  
  Serial.print("zeroCalibrating...");
  gyro.zeroCalibrate(2500, 2);//(number of mesaurments, milliseconds between them)
  Serial.println("done.");
}

void loop(void) {
    while (gyro.isRawDataReady()) {
   // Reads calibrated values in deg/sec    
    gyro.readGyro(&x,&y,&z);
    time_1=time_2;
    time_2 = micros();
    if (time_1!=0){
 
angleServas4=angleServas4+2*y*((float)time_2-(float)time_1)/10000;
//angleServas1=angleServas1+2*y*((float)time_2-(float)time_1)/10000;
//angleServas2=angleServas2+2*y*((float)time_2-(float)time_1)/10000;
//angleServas3=angleServas3+2*y*((float)time_2-(float)time_1)/10000;

        angleServas2=angleServas2+2*y*((float)time_2-(float)time_1)/1000000;

        angleServas1=angleServas1+2*x*((float)time_2-(float)time_1)/1000000;
        angleServas3=angleServas3+2*x*((float)time_2-(float)time_1)/1000000;
    }
   ServoPositionServo1=90-angleServas1;
   ServoPositionServo2=90-angleServas2;
   ServoPositionServo3=90-angleServas3;
   ServoPositionServo4=90-angleServas4;
  
   servas1.write(ServoPositionServo1);
  
   servas2.write(ServoPositionServo2);
  
   servas3.write(ServoPositionServo3);
  
   servas4.write(ServoPositionServo4);
}
}
4  Using Arduino / Project Guidance / Re: including background, font "methods" or something on: January 30, 2012, 02:56:47 pm
But in this video that guy loads from arduino soft that bars..
5  Using Arduino / Project Guidance / including background, font "methods" or something on: January 30, 2012, 09:11:58 am
Hi everyone, i have code for GYRO ITG3200 output with interface.. so when im loading processing code to atmega after that im loading other code where in output displays gyro axes bars, but is one broblem... When press "Verify" in arduino soft with output gyro axes bars i have some errors with background, fonts tag and others... So what i must to do? Load some libs fot that or something?
There is code:
 
Code:
/**
 * Displays values coming from an ITG3200 gyro connected to Arduino
*/

import processing.serial.*;

Serial myPort;  // Create object from Serial class

int temp = 0;
int x = 0;
int y = 0;
int z = 0;

int lf = 10; // 10 is '\n' in ASCII
byte[] inBuffer = new byte[50];

PFont font;


void setup()
{
  size(600, 600);
  myPort = new Serial(this, "/dev/ttyUSB0", 9600); 
 
  // The font must be located in the sketch's
  // "data" directory to load successfully
  font = loadFont("CourierNew36.vlw");
}


void draw() {
  if(myPort.available() > 0) {
    if (myPort.readBytesUntil(lf, inBuffer) > 0) {
      String inputString = new String(inBuffer);
      String [] inputStringArr = split(inputString, ',');
     
      temp = int(inputStringArr[0]);
      x = int(inputStringArr[1]);
      y = int(inputStringArr[2]);
      z = int(inputStringArr[3]);
    }
  }
 
  background(#000000);
 
  int R = 0;
  int G = 255;
  int B = 0;
  color greencolor = color(R, G, B);
  fill(greencolor);
 
  float x_ds = (float(x) / 14.375); // converts to degrees/sec
  float hx = x_ds * 250 / 2000; //compute rectange higth
  rect(50, 250, 50, hx * 3);
 
  float y_ds = (float(y) / 14.375);
  float hy = y_ds * 250 / 2000;
  rect(150, 250, 50, hy * 3);
 
  float z_ds = (float(z) / 14.375);
  float hz = z_ds * 250 / 2000;
  rect(250, 250, 50, hz * 3);
 
  textFont(font);
  float temp_decoded = 35.0 + ((float) (temp + 13200)) / 280;
  text("temp:\n" + temp_decoded + " C", 350, 250);
  text("raw: " + x + " " + y + " " + z + "\n°/s: " + x_ds + " " + y_ds + "\n" + z_ds/* + " " + temp+ xmin + " " + ymin + " " + zminhx + " " + hy + " " + hz */, 20, 500);
 
}

Moderator: Code tags.
Pages: [1]