Show Posts
Pages: 1 [2] 3 4 ... 6
16  Using Arduino / Programming Questions / Re: HMC6352 compass converting degrees to direction problem? on: February 01, 2013, 02:31:40 pm
Code:
101E
101E
102E
98E
17  Using Arduino / Programming Questions / HMC6352 compass converting degrees to direction problem? on: February 01, 2013, 02:23:45 pm
hello everyone
i want to covert to the value of the degree to direction
Code:
//All this does is read the heading from HMC6352 and spit it out via serial

#include <Wire.h>
int HMC6352SlaveAddress = 0x42;
int HMC6352ReadAddress = 0x41; //"A" in hex, A command is:

int headingValue;

void setup(){
  // "The Wire library uses 7 bit addresses throughout.
  //If you have a datasheet or sample code that uses 8 bit address,
  //you'll want to drop the low bit (i.e. shift the value one bit to the right),
  //yielding an address between 0 and 127."
  HMC6352SlaveAddress = HMC6352SlaveAddress >> 1; // I know 0x42 is less than 127, but this is still required

  Serial.begin(9600);
  Wire.begin();
}

void loop(){
  //"Get Data. Compensate and Calculate New Heading"
  Wire.beginTransmission(HMC6352SlaveAddress);
  Wire.write(HMC6352ReadAddress);              // The "Get Data" command
  Wire.endTransmission();

  //time delays required by HMC6352 upon receipt of the command
  //Get Data. Compensate and Calculate New Heading : 6ms
  delay(6);

  Wire.requestFrom(HMC6352SlaveAddress, 2); //get the two data bytes, MSB and LSB

  //"The heading output data will be the value in tenths of degrees
  //from zero to 3599 and provided in binary format over the two bytes."
  byte MSB = Wire.read();
  byte LSB = Wire.read();

  int headingSum = (MSB << 8) + LSB; //(MSB / LSB sum)
  headingSum = headingSum / 10;
int value = headingSum ;
Serial.print(headingSum);

  if (value > 68 || value < 112) {
    Serial.println("E");
  }
   

  delay(500);
}
but the result are wrong  the if statement doesn't work
any one can help me?
thanks for replaying
18  Using Arduino / Sensors / Re: HDJD-S822 Color Sensor Code? on: January 24, 2013, 12:42:18 pm
i try again but it still give's wrong value while i did the wire connection better?
Please anyone help me!
19  Using Arduino / Installation & Troubleshooting / Re: Arduino uno I/O pins output are 4.2v not 5v on: January 19, 2013, 11:58:59 pm
i make one pin output and take out by a jumper wire then measure it by mutlimeter.
i connect them relay and they can't swith the relay but when i connect directly the relay to 5+ it switch.
before i did this and there was no problem//
20  Using Arduino / Installation & Troubleshooting / Re: Arduino uno I/O pins output are 4.2v not 5v on: January 19, 2013, 11:41:51 pm
yes, all pins have the same problem and here the sketch:
Code:
int pin1= 11;
int pin2= 12;
int pin3= 13;
int counter = 0;
void setup(){
 Serial.begin(9600);
pinMode(pin1, OUTPUT);
pinMode(pin2, OUTPUT); 
  pinMode(pin3, OUTPUT);
 
}
 void loop() {
   int input = Serial.read();
   
   if (input == '3') {
      if (counter == 0) {
      Serial.print("on");
    analogWrite(pin3, 255);
     delay(5000);
      counter++;
      input = 0;
      }
   }
    if (input == '4') {
      if (counter == 0) {
     digitalWrite(pin3, LOW);
     Serial.print("low");
     counter++;
     input = 0;
      }
   }
    if (input == '1') {
       if (counter == 0) {
      Serial.print("1");
     digitalWrite(pin1, HIGH);
     
     delay(150);
      digitalWrite(pin1, LOW);
       counter++;
       input = 0;
       }
   }
    if (input == '2') {
       if (counter == 0) {
      Serial.print("2");
     digitalWrite(pin2, HIGH);
     delay(50);
      digitalWrite(pin2, LOW);
      delay(50);
      digitalWrite(pin2, HIGH);
     delay(50);
      digitalWrite(pin2, LOW);
       counter++;
       input = 0;
       
       }
       
   }
   counter = 0;
   }
   
21  Using Arduino / Installation & Troubleshooting / Arduino uno I/O pins output are 4.2v not 5v on: January 19, 2013, 05:52:54 pm
hi there
i have a problem with arduino when i checked output of digital pin it gave me 4.2v instead of 5v, and i need 5v,any solution?
i don't know what is wrong, thanks for helping!
best regards
22  Using Arduino / Sensors / Re: HDJD-S822 Color Sensor Code? on: December 23, 2012, 10:13:36 am
thanks for all replay but i have a question about the range
does anyone know more about this sensor technically??
23  Using Arduino / Sensors / Re: HDJD-S822 Color Sensor Code? on: December 22, 2012, 01:55:13 pm
i just connected by jumber wire and breadboard
24  Using Arduino / Sensors / Re: HDJD-S822 Color Sensor Code? on: December 22, 2012, 12:41:40 pm
what should i do to make it better?
25  Using Arduino / Sensors / Re: HDJD-S822 Color Sensor Code? on: December 22, 2012, 12:30:55 pm
ah sorry here
https://www.sparkfun.com/products/10904

but the red rgb is 255,0,0
like if you put a red paper will it also be 255,0,0 or different because i think the light also effect it
thanks for helping me bro
26  Using Arduino / Sensors / Re: HDJD-S822 Color Sensor Code? on: December 22, 2012, 12:09:02 pm
can your give me the sketch?
27  Using Arduino / Sensors / Re: HDJD-S822 Color Sensor Code? on: December 22, 2012, 11:14:15 am
yellow paper
Code:
Red: 210 Green: 392 Blue: 136
Red: 180 Green: 336 Blue: 119
Red: 190 Green: 350 Blue: 119
Red: 180 Green: 336 Blue: 119


red paper
Code:
Red: 100 Green: 140 Blue: 731
Red: 100 Green: 140 Blue: 612
Red: 100 Green: 140 Blue: 476
Red: 100 Green: 140 Blue: 357
Red: 100 Green: 154 Blue: 306
Red: 100 Green: 154 Blue: 238
Red: 100 Green: 140 Blue: 170
28  Using Arduino / Sensors / Re: HDJD-S822 Color Sensor Code? on: December 22, 2012, 10:56:43 am
does it need to be in a dark room or the room light doesn't affect it?
does it need to switch on the led on the board, or not?
please explain more clearly cuz i'm a newbie
29  Using Arduino / Sensors / Re: HDJD-S822 Color Sensor Code? on: December 22, 2012, 10:19:09 am
could give an anther code example and can you give sketch if you can
with my best regards
30  Using Arduino / Sensors / Re: HDJD-S822 Color Sensor Code? on: December 22, 2012, 10:02:28 am
thanks for replaying, i just test some sticker papers , 5 cm away from the sensor
Pages: 1 [2] 3 4 ... 6