Create a gist now

Instantly share code, notes, and snippets.

@enukane /qc22v.ino
Last active Jan 11, 2017

#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