Skip to content

Instantly share code, notes, and snippets.

@enukane
Last active January 11, 2017 07:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save enukane/26f3af8938ed2a775296f472b1c71168 to your computer and use it in GitHub Desktop.
Save enukane/26f3af8938ed2a775296f472b1c71168 to your computer and use it in GitHub Desktop.
#include <Arduino.h>
#include <avr/sleep.h>
const int D_PLUS = 11;
const int D_MINUS = 12;
/**
* Arduino nano has 5V regulated power, so required voltages are generated with:
* 3.3V: 4.7kΩ / 9.1kΩ
* 0.6V: 1.1kΩ / 150Ω
*
*/
void setup() {
// wait until stable connection
Serial.begin(9600);
delay(1000);
Serial.println("Reset line");
// reset line
pinMode(D_PLUS, OUTPUT);
pinMode(D_MINUS, OUTPUT);
digitalWrite(D_PLUS, LOW);
digitalWrite(D_MINUS, LOW);
delay(100);
Serial.println("set 0.6V to D+/D- for 1.25s");
// D+ and D- to 0.6V for 1.25s
digitalWrite(D_PLUS, HIGH);
digitalWrite(D_MINUS, HIGH);
delay(1250);
Serial.println("set low for D- for 1ms");
// D- to 0V for 1ms
digitalWrite(D_MINUS, LOW);
delay(100);
Serial.println("set D- HIGH");
// Set voltage
digitalWrite(D_MINUS, HIGH);
Serial.println("go Down");
Serial.flush();
set_sleep_mode(SLEEP_MODE_PWR_DOWN);
sleep_mode();
}
void loop() {
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment