https://www.noisebridge.net/index.php?title=EBB_Notes_3&feed=atom&action=history
EBB Notes 3 - Revision history
2024-03-29T09:06:15Z
Revision history for this page on the wiki
MediaWiki 1.39.4
https://www.noisebridge.net/index.php?title=EBB_Notes_3&diff=16788&oldid=prev
Rbelknap: added category tag
2011-02-25T22:29:10Z
<p>added category tag</p>
<table style="background-color: #fff; color: #202122;" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr class="diff-title" lang="en">
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">← Older revision</td>
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">Revision as of 15:29, 25 February 2011</td>
</tr><tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l113">Line 113:</td>
<td colspan="2" class="diff-lineno">Line 113:</td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>}</div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>}</div></td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div></pre></div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div></pre></div></td></tr>
<tr><td colspan="2" class="diff-side-deleted"></td><td class="diff-marker" data-marker="+"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;">[[Category:Sensebridge]]</ins></div></td></tr>
</table>
Rbelknap
https://www.noisebridge.net/index.php?title=EBB_Notes_3&diff=4493&oldid=prev
Rachel: New page: I (Rachel) moved the MAXsonar sensor circuit to my own boarduino, successfully. I copied Lamont's shift register/PWM circuit to my own boarduino, again (eventually) successfully. So far t...
2009-04-13T19:38:20Z
<p>New page: I (Rachel) moved the MAXsonar sensor circuit to my own boarduino, successfully. I copied Lamont's shift register/PWM circuit to my own boarduino, again (eventually) successfully. So far t...</p>
<p><b>New page</b></p><div>I (Rachel) moved the MAXsonar sensor circuit to my own boarduino, successfully. I copied Lamont's shift register/PWM circuit to my own boarduino, again (eventually) successfully. So far this is mere sideways motion... but I have made actual progress in understanding the PWM code, so should soon be able to modify it to include the sensor. Yay tiny progress!<br />
<br />
Current unsuccessful code that attempts to read the MAXsonar EZ1's serial out:<br />
<pre><br />
#include <ctype.h><br />
<br />
#define bit9600Delay 84 <br />
#define halfBit9600Delay 42<br />
#define bit4800Delay 188 <br />
#define halfBit4800Delay 94 <br />
#define PACKET_LENGTH 5<br />
<br />
byte rx = 2;<br />
byte tx = 3;<br />
byte SWval[PACKET_LENGTH];<br />
<br />
void setup() {<br />
pinMode(rx,INPUT);<br />
pinMode(tx,OUTPUT);<br />
digitalWrite(tx,HIGH);<br />
digitalWrite(13,HIGH); //turn on debugging LED<br />
// SWprint('h'); //debugging hello<br />
// SWprint('i');<br />
// SWprint(10); //carriage return<br />
Serial.begin(9600);<br />
}<br />
<br />
void loop() {<br />
Serial.println("begin: ");<br />
<br />
// wait for the start of a packet<br />
int allLow = 1;<br />
while(!allLow) {<br />
allLow = 1;<br />
for(int i = 0; i < 10*10; ++i) {<br />
delayMicroseconds(bit9600Delay);<br />
if(digitalRead(rx) == HIGH) {<br />
allLow = 0;<br />
}<br />
}<br />
}<br />
Serial.println("p");<br />
<br />
// read a packet<br />
for(int i = 0; i < PACKET_LENGTH; ++i) {<br />
SWval[i] = SWreadNi(); <br />
}<br />
Serial.println("r");<br />
<br />
// print the packet<br />
// TESTING shows that this bit is BROKEN.<br />
for(int i = 0; i < PACKET_LENGTH; ++i) {<br />
for(int j = 0; j < 8; ++i) {<br />
Serial.print( (SWval[i] >> j) & 1 );<br />
}<br />
Serial.print(" ");<br />
}<br />
Serial.println();<br />
Serial.println();<br />
}<br />
<br />
void SWprint(int data) {<br />
byte mask;<br />
//startbit<br />
digitalWrite(tx,LOW);<br />
delayMicroseconds(bit9600Delay);<br />
for (mask = 0x01; mask>0; mask <<= 1) {<br />
if (data & mask){ // choose bit<br />
digitalWrite(tx,HIGH); // send 1<br />
}<br />
else{<br />
digitalWrite(tx,LOW); // send 0<br />
}<br />
delayMicroseconds(bit9600Delay);<br />
}<br />
//stop bit<br />
digitalWrite(tx, HIGH);<br />
delayMicroseconds(bit9600Delay);<br />
}<br />
<br />
int SWreadNi() {<br />
byte val = 0;<br />
while (digitalRead(rx) == LOW);<br />
//wait for start bit<br />
if (digitalRead(rx) == HIGH) {<br />
delayMicroseconds(halfBit9600Delay);<br />
for (int offset = 0; offset < 8; offset++) {<br />
delayMicroseconds(bit9600Delay);<br />
val |= (digitalRead(rx) << offset);<br />
}<br />
//wait for stop bit + extra<br />
// delayMicroseconds(bit9600Delay); <br />
// delayMicroseconds(bit9600Delay);<br />
return ~val;<br />
}<br />
}<br />
<br />
int SWread() {<br />
byte val = 0;<br />
while (digitalRead(rx));<br />
//wait for start bit<br />
if (digitalRead(rx) == LOW) {<br />
delayMicroseconds(halfBit9600Delay);<br />
for (int offset = 0; offset < 8; offset++) {<br />
delayMicroseconds(bit9600Delay);<br />
val |= digitalRead(rx) << offset;<br />
}<br />
//wait for stop bit + extra<br />
delayMicroseconds(bit9600Delay); <br />
delayMicroseconds(bit9600Delay);<br />
return val;<br />
}<br />
}<br />
</pre></div>
Rachel