Skip to content

Commit 9c5b09f

Browse files
committed
Merge branch 'trunk' of https://github.com/dplassgit/arduino into trunk
2 parents 5083d72 + dae9275 commit 9c5b09f

File tree

7 files changed

+104
-66
lines changed

7 files changed

+104
-66
lines changed

README.md

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Arduino sketches
2+
3+
A [PLASS] Program
4+
5+
## To download
6+
7+
git clone [email protected]:dplassgit/arduino.git
8+
9+
## To upload
10+
11+
git push origin trunk

keyboardv0/README.md

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Keyboard v0
2+
3+
An Arduino sketch to retrieve serial binary from the Vector Graph 4 keyboard.
4+
5+
After an active-low trigger, the first bit is skipped, then
6+
subsequent bits are shifted in LSB to MSB, for 7 bits.
File renamed without changes.

logic_analyzer/README.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Keyboard v0
2+
3+
An Arduino sketch to act like a logic analyzer.
4+
5+
After an active-low trigger, bits are read until N consecutive 1s are seen.

logic_analyzer/logic_analyzer.ino

+82
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
/*
2+
* Simple logic analyzer. Triggers when the data pin goes low.
3+
* Records bits until 30 1's in a row are received.
4+
* Attemps to debounce the button (poorly). Resets the board
5+
* (reset pin low) when the button is pressed, and starts listening.
6+
*/
7+
8+
const int buttonPin = 7; // the number of the pushbutton pin
9+
const int dataPin = 2; // corresponds to pin 6 on the KB connector (and pin 6 of the RJ12)
10+
const int resetPin = 5; // corresponds to pin 2 on the KB connector (and pin 4 on the RJ12)
11+
12+
int buttonState = 0; // variable for reading the pushbutton status
13+
14+
void setup() {
15+
pinMode(LED_BUILTIN, OUTPUT);
16+
pinMode(buttonPin, INPUT);
17+
pinMode(resetPin, OUTPUT);
18+
pinMode(dataPin, INPUT);
19+
20+
// Set the reset pin low for 10 ms.
21+
digitalWrite(resetPin, LOW);
22+
delay(10);
23+
digitalWrite(resetPin, HIGH);
24+
25+
Serial.begin(9600);
26+
Serial.println("Hello logic_analyzer");
27+
}
28+
29+
int changed = 0;
30+
int shouldRead = 0;
31+
int data = 0;
32+
int inKey = 0; // are we reading a key?
33+
int numOnes = 0; // the # of 1s in a row
34+
35+
void loop() {
36+
// read the state of the pushbutton value:
37+
buttonState = digitalRead(buttonPin);
38+
39+
// check if the pushbutton is pressed. If it is, the buttonState is HIGH:
40+
if (buttonState == HIGH && !changed) {
41+
// turn LED on, and toggle recording.
42+
digitalWrite(LED_BUILTIN, HIGH);
43+
Serial.println("on");
44+
shouldRead = 1 - shouldRead;
45+
Serial.print("ShouldRead is "); Serial.println(shouldRead);
46+
changed = 1;
47+
} else if (buttonState == LOW && changed) {
48+
// turn LED off:
49+
digitalWrite(LED_BUILTIN, LOW);
50+
Serial.println("off");
51+
changed = 0;
52+
53+
// beep/reset, and keep reading.
54+
digitalWrite(resetPin , LOW);
55+
delay(10);
56+
digitalWrite(resetPin , HIGH);
57+
}
58+
59+
if (shouldRead == 1) {
60+
data = digitalRead(dataPin);
61+
if (data == LOW && !inKey) {
62+
inKey=1; // we're recording until numones==30
63+
numOnes=0;
64+
Serial.println("START");
65+
Serial.println("0");
66+
} else if (inKey) {
67+
if (data == HIGH) {
68+
Serial.println("1");
69+
numOnes++;
70+
if (numOnes == 30) {
71+
inKey=0;
72+
numOnes=0;
73+
Serial.println("END");
74+
delay(500);
75+
}
76+
} else {
77+
numOnes=0;
78+
Serial.println("0");
79+
}
80+
}
81+
}
82+
}
File renamed without changes.

vg4_keyboard/logic_analyzer/logic_analyzer.ino

-66
This file was deleted.

0 commit comments

Comments
 (0)