Hackster is hosting Hackster Holidays, Ep. 7: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Friday!Stream Hackster Holidays, Ep. 7 on Friday!
Bill Debevc
Published © CC BY-SA

The Great Mojave Rover

The Great Mojave Rover Project is an autonomous rover built to survive the extreme conditions of the Mojave Desert. [Work in Progress]

AdvancedWork in progressOver 4 days2,625

Things used in this project

Story

Read more

Schematics

Solar Test #5

This is the wiring diagram for Solar Test 8

Code

Alpha - Shutdown and Startup from Arduino

C/C++
This is an Alpha version of the code that will shutdown the Raspberry Pi at night and start it up in the morning. It utilizes a LiPo Shim to control the power to the Pi
int sensorPin = A0; // select the input pin for LDR
int sensorValue = 0; // variable to store the value coming from the sensor
const int shutdownPin = 4;
const int enablePin = 3;
int PiPowerState = 1;
void setup() {
Serial.begin(9600); //sets serial port for communication
Serial.println("Starting.");
pinMode(LED_BUILTIN, OUTPUT);
  digitalWrite(LED_BUILTIN, HIGH);
pinMode(shutdownPin, OUTPUT);
  digitalWrite(shutdownPin, HIGH);
pinMode(enablePin, OUTPUT);
  digitalWrite(enablePin, HIGH);
Serial.println("Setup Complete");
}

void loop() {
sensorValue = analogRead(sensorPin); // read the value from the sensor
Serial.println(sensorValue); //prints the values coming from the sensor on the screen
Serial.println(PiPowerState);
if (sensorValue < 750) 
    {
        Serial.println ("Shutdown to LOW");
        //digitalWrite(shutdownPin, LOW);
        Serial.println ("Waiting");
        delay(15000);
        Serial.println ("Enable to LOW");
        digitalWrite(enablePin, LOW);
        Serial.println ("Waiting");
        delay(50);
        Serial.println ("Shutdown to HIGH");
        digitalWrite(shutdownPin, HIGH);
    } 
    else 
    {
        digitalWrite(enablePin, HIGH);
    }
  

  
delay(100);

}

Credits

Bill Debevc
1 project • 3 followers
Follow the build log on https://thegreatmojaverover.com

Comments