[Week 3 FYP2] Development of Easy Parking Finder System



Activity Title :

- Construct a code for my Nodemcu and sensor.

Objective :

To test whether code in week 15 is suitable for Nodemcu or not.
·
Content :

In week 15, i already construct the code for UNO and sensor. This week i test the same code for my NodeMcu. What i can conclude from test, the result is failed because tools in arduino is not tally with my board. so, i had to change the board before i upload the code in the NodeMcu. 

Code: 

// defines pins numbers
const int trigPin = 2;  //D4
const int echoPin = 0;  //D3

// defines variables

long duration;
int distance;

void setup() {

  pinMode(trigPin, OUTPUT); // Sets the trigPin as an Output
  pinMode(echoPin, INPUT); // Sets the echoPin as an Input
  Serial.begin(9600); // Starts the serial communication
}

void loop() {

// Clears the trigPin
  digitalWrite(trigPin, LOW);
  delayMicroseconds(2);

// Sets the trigPin on HIGH state for 10 micro seconds

digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);

// Reads the echoPin, returns the sound wave travel time in microseconds

duration = pulseIn(echoPin, HIGH);

// Calculating the distance

distance = duration*0.034/2;
// Prints the distance on the Serial Monitor
Serial.print("Distance: ");
Serial.println(distance);
delay(2000);

}


There have a problem which is the code cannot be store in the nodemcu when i disconnect the usb port with node mcu.




Result and Analysis:

To solve the problem, i need to connect the FLASH pin with 3V pin before i disconnect the USB port. This is because the latest version for NodeMcu have different architecture comparing with previous version. 

Conclusion:
As a conclusion, i need to connect this pin to store the code in NodeMcu.

Comments

Popular posts from this blog

[Week 13 FYP2] Development of Easy Parking Finder System

[Week 7 FYP1] Development of Easy Parking Finder System

[Week 14 FYP1] Development of Easy Parking Finder System