Go Down

Topic: Re: exit status 1 (Read 599 times) previous topic - next topic

Thabo

i need help with the code below, i want to program it on the pro-mini chip but so far im finding it difficult to get it right.

#include <VirtualWire.h>

const int trigPin = 2;

const int echoPin = 4;

char Distance[4]; void setup() {

Serial.begin(9600);

vw_setup(2000);     

}

void loop() {

int duration, distance, cm;

pinMode(trigPin, OUTPUT);

digitalWrite(trigPin, LOW);

delayMicroseconds(2);

digitalWrite(trigPin, HIGH);

delayMicroseconds(10);

digitalWrite(trigPin, LOW);

pinMode(echoPin, INPUT);

duration = pulseIn(echoPin, HIGH);

distance=duration*34/200000;

//Convert metre to cm

cm = distance*100

Serial.print(cm);

Serial.print("cm");

Serial.println();

delay(100);
//Convert integer value to character value

itoa(cm,Distance,10);

digitalWrite(13, true); // Turn on a light to show transmitting

vw_send((uint8_t *)Distance, strlen(Distance));

vw_wait_tx(); // Wait until the whole message is gone

digitalWrite(13, false); // Turn off a light after transmission

delay(200);

}

pert

i need help with the code below
You're failing at using this forum on every level. important information is explained in the How to use this forum post. Please read it.

PaulS

Code: [Select]
  cm = distance*100

    Serial.print(cm);

Semicolons on the ends of statements are NOT optional.
The art of getting good answers lies in asking good questions.

Go Up