Last active
January 11, 2017 07:53
-
-
Save enukane/26f3af8938ed2a775296f472b1c71168 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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