Show Posts
Pages: [1] 2
1  Using Arduino / Programming Questions / Re: how to read analog value continuous with Serial.read() on: April 06, 2013, 08:43:49 am
Thanks all i'm finish my code, serial monitor can read analog value continuous now.
Code:
 const int ledPin = 13;
void setup() {
  Serial.begin(9600);
  pinMode(ledPin, OUTPUT);
  pinMode(9, OUTPUT);
}
int incomingByte;
void loop() {
  int sensorValue1 = analogRead(A0);
  int sensorValue2 = analogRead(A1);
  int sensorValue3 = analogRead(A2);
  if (Serial.available() ) {
  // read the oldest byte in the serial buffer:
    incomingByte = Serial.read();
   }
  switch (incomingByte) {
    case 'a':
       Serial.println(sensorValue1);
       break;
    case 'b':
       Serial.println(sensorValue2);
       break;
    case 'c':
       Serial.println(sensorValue3);
       break;
    case 'H':
       digitalWrite(ledPin, HIGH);
       break;
    case 'L':
       digitalWrite(ledPin, LOW);
       break;
  }
    delay(300);
    }

  
  
    
2  Using Arduino / Programming Questions / Re: how to read analog value continuous with Serial.read() on: April 06, 2013, 08:20:53 am
i want my program to receive analog value from analog pin A0 A1 A2 selected by sending character in serial monitor.
3  Using Arduino / Programming Questions / Re: how to read analog value continuous with Serial.read() on: April 06, 2013, 08:07:14 am
thanks again , but this monitoring single value same the old.

Code:
const int ledPin = 13;
void setup() {
 
  Serial.begin(9600);
  pinMode(ledPin, OUTPUT);
  pinMode(9, OUTPUT);
}


void loop() {
   
  int sensorValue1 = analogRead(A0);
  int sensorValue2 = analogRead(A1);
  int sensorValue3 = analogRead(A2);
  int light_sensitivity = 500;
  int incomingByte;
 
    // read the oldest byte in the serial buffer:
    if(Serial.available()){
    incomingByte = Serial.read();
    }
  switch (incomingByte) {
   
    case 'a':
       Serial.println(sensorValue1);
       break;
    case 'b':
       Serial.println(sensorValue2);
       break;
    case 'c':
       Serial.println(sensorValue3);
       break;
    case 'H':
       digitalWrite(ledPin, HIGH);
       break;
    case 'L':
       digitalWrite(ledPin, LOW);
       break;
  }
    if (sensorValue3 < light_sensitivity)
      {
        digitalWrite(9, HIGH);
      }
     else
      {
        digitalWrite(9, LOW);
       
      }
      delay(300);
    }


 
   
4  Using Arduino / Programming Questions / Re: how to read analog value continuous with Serial.read() on: April 06, 2013, 07:57:56 am
Thanks,  but after i remove the first if statement serial monitor displayed single analogvalue same the old.

Code:
const int ledPin = 13;
void setup() {
 
  Serial.begin(9600);
  pinMode(ledPin, OUTPUT);
  pinMode(9, OUTPUT);
}


void loop() {
   
  int sensorValue1 = analogRead(A0);
  int sensorValue2 = analogRead(A1);
  int sensorValue3 = analogRead(A2);
  int light_sensitivity = 500;
  int incomingByte;
 
    // read the oldest byte in the serial buffer:
    incomingByte = Serial.read();
 
  switch (incomingByte) {
   
    case 'a':
       Serial.println(sensorValue1);
       break;
    case 'b':
       Serial.println(sensorValue2);
       break;
    case 'c':
       Serial.println(sensorValue3);
       break;
    case 'H':
       digitalWrite(ledPin, HIGH);
       break;
    case 'L':
       digitalWrite(ledPin, LOW);
       break;
  }
    if (sensorValue3 < light_sensitivity)
      {
        digitalWrite(9, HIGH);
      }
     else
      {
        digitalWrite(9, LOW);
       
      }
      delay(300);
    }

5  Using Arduino / Programming Questions / Re: how to read analog value continuous with Serial.read() on: April 06, 2013, 05:05:55 am
i'm not ignoring it but this not work ,program still monitoring single value same the old.
6  Using Arduino / Programming Questions / Re: how to read analog value continuous with Serial.read() on: April 06, 2013, 04:51:35 am
sorry again for my bad english skill

i want my program to receive analog value from analog pin A0 A1 A2 selected by type and send letters in serial monitor.

now i use switch case for my program , but this serial monitor display single value, i want this to monitoring value continuous like in a loop.



7  Using Arduino / Programming Questions / Re: how to read analog value continuous with Serial.read() on: April 06, 2013, 04:35:47 am
 Thanks , Grumpy_Mike

but this not work ,program still monitoring single value.
8  Using Arduino / Programming Questions / Re: how to read analog value continuous with Serial.read() on: April 06, 2013, 04:22:21 am
i want serial monitor to monitoring continuous like a loop , not single value.
9  Using Arduino / Programming Questions / Re: how to read analog value continuous with Serial.read() on: April 06, 2013, 03:40:59 am
Thanks Robin.
Sorry for bad english

when i don't read from serial.read this program work well (use analogRead)

i think this problem is in serial.read can receive only one data , when i rotate the potentiometer and send 'a' again value is changed but i want to send 'a' once and program monitoring continuous likes to use analogRead.
10  Using Arduino / Programming Questions / Re: how to read analog value continuous with Serial.read() on: April 06, 2013, 02:56:45 am

from this program , e.g. when i type 'a' and send in serial monitor this monitoring one value (not continuous) and i try to use for , while but its monitoring one value repeat not change when i change the value (from Potentiometer)

i want its to read value continuous not one value .

 
11  Using Arduino / Programming Questions / how to read analog value continuous with Serial.read() on: April 06, 2013, 02:43:36 am
from this sketch i can read analog value each case for once value i think Serial.read read the oldest byte but i want to read from present byte like without its how can i setting this ?  

Code:
const int ledPin = 13;
void setup() {
 
  Serial.begin(9600);
  pinMode(ledPin, OUTPUT);
  pinMode(9, OUTPUT);
}


void loop() {
   if (Serial.available() > 0) {
  int sensorValue1 = analogRead(A0);
  int sensorValue2 = analogRead(A1);
  int sensorValue3 = analogRead(A2);
  int light_sensitivity = 500;
  int incomingByte;
  
    // read the oldest byte in the serial buffer:
    incomingByte = Serial.read();
  
  switch (incomingByte) {
    
    case 'a':
       Serial.println(sensorValue1);
       break;
    case 'b':
       Serial.println(sensorValue2);
       break;
    case 'c':
       Serial.println(sensorValue3);
       break;
    case 'H':
       digitalWrite(ledPin, HIGH);
       break;
    case 'L':
       digitalWrite(ledPin, LOW);
       break;
  }
    if (sensorValue3 < light_sensitivity)
      {
        digitalWrite(9, HIGH);
      }
     else
      {
        digitalWrite(9, LOW);
        
      }
      delay(300);
    }
}  
12  Using Arduino / Networking, Protocols, and Devices / temperature value changed when wireless communication with xbee on: February 15, 2013, 01:57:58 pm
I've use 2 xbee Series2 in AT-Command Mode , Arduino UNO R3 , lm335

if i plugged in the Arduino with Laptop USB Port the temperature value is correct but if i plugged off and use External Battery(9 V) temperature value on Coordinator Com Port(Xbee Receiver) is changed(error). How Can I fix the problem ?

 
13  Using Arduino / Networking, Protocols, and Devices / xbee die when upload sketch to arduino board. on: January 14, 2013, 01:04:11 am
please help me. , when i've set the Xbee on arduino shield to Zigbee end devices AT , then upload temperature read sketch to arduino the xbee is die(red led off) how can i config this or i've something wrong ?
14  Using Arduino / Networking, Protocols, and Devices / Xbee and LabVIEW on: January 12, 2013, 04:39:47 am
I've use Arduino UNO and Xbee for temperature monitoring in LabVIEW

my question is Xbee need to config with X-CTU or Never before communication with LAbVIEW ?
15  Using Arduino / Interfacing w/ Software on the Computer / Re: how to use LabVIEW for receive data from serial monitor ? on: January 12, 2013, 02:49:08 am
How Xbee Need to use X-CTU before communication with LabVIEW ?
Pages: [1] 2