Code.Code History
Hide minor edits - Show changes to output
Added lines 47-48:
[[Code.TMP102 | TMP102 temperature sensor using I2C {Arduino) ]]
Added lines 47-48:
[[Code.Thermistor 10k | Thermistor 10k sensor - output in Fahrenheit and Celsius {Arduino) ]]
Added lines 48-50:
[[Code.AtmegaInternalTemperature | Read the internal temperature sensor of an Atmega328 (Arduino) ]]
[[Code.AtmegaInternalVoltage | Read the internal voltage sensor of an Atmega328 (Arduino) ]]
[[Code.AtmegaInternalVoltage | Read the internal voltage sensor of an Atmega328 (Arduino) ]]
Added lines 45-46:
[[Code.TMP36 | TMP36 Temperature sensor {Arduino) ]]
Added lines 22-25:
[[Code.VoltageConversion | converting ADC readings to voltage (Arduino)]]
[[Code.RunningAverageWithWeighting|Running Average With Weighting (Arduino)]]
[[Code.RunningAverageWithWeighting|Running Average With Weighting (Arduino)]]
Changed lines 58-63 from:
[[http://www.tigoe.net/pcomp/code/category/code/arduinowiring/140|Sensor Graphs in 3 Lines of Code + OSX Graph]]
to:
[[http://arduino.cc/en/Tutorial/RCtime | RCTime on an Arduino]]
[[http://arduino.cc/en/Tutorial/Smoothing|Averaging (Smoothing) analog sensor readings (Arduino)]]
[[http://arduino.cc/en/Tutorial/Calibration|Calibrating analog sensor readings (Arduino)]]
[[http://arduino.cc/en/Tutorial/Smoothing|Averaging (Smoothing) analog sensor readings (Arduino)]]
[[http://arduino.cc/en/Tutorial/Calibration|Calibrating analog sensor readings (Arduino)]]
Changed lines 1-3 from:
This page lists code samples from the sensor reports. There are also a few general examples here as well. All major pieces of code for the wiki should be linked here. \\\
[[Code.Sample|A Sample code Page]]
[[Code.Sample|
to:
This page lists code samples from the sensor reports. There are also a few general examples here as well. All major pieces of code for the wiki should be linked here.
'''A note on code on this wiki:''' If you use existing code from the code links here or elsewhere, please cite it and link to it. If you only make minor modifications, there's no need to post a whole new code sample. You can just make note of the change in your assignment summary. But if you come up with a significant improvement, please post it in the [[Code.Sample| Code group of the Wiki]] and comment it well, so others may benefit.\\
[[~tigoe]] & [[~jamie]]
[[Code.Sample|A Sample code Page]] Here are some notes on how your code samples should be formatted.
'''A note on code on this wiki:''' If you use existing code from the code links here or elsewhere, please cite it and link to it. If you only make minor modifications, there's no need to post a whole new code sample. You can just make note of the change in your assignment summary. But if you come up with a significant improvement, please post it in the [[Code.Sample| Code group of the Wiki]] and comment it well, so others may benefit.\\
[[~tigoe]] & [[~jamie]]
[[Code.Sample|A Sample code Page]] Here are some notes on how your code samples should be formatted.
Added lines 23-24:
[[Code.ThreeSensorsCallResponseHumanReadable|Three Sensors, Call/Response with Full String Messages (Arduino-Processing)]]
Changed lines 21-22 from:
[[Code.ThreeSensors|Three Sensors, Call and Response (Arduino-Processing)]] - Taken from physcomp serial section
to:
[[Code.ThreeSensorsCallResponse|Three Sensors, Call and Response (Arduino-Processing)]] - Taken from physcomp serial section
Added lines 21-22:
[[Code.ThreeSensors|Three Sensors, Call and Response (Arduino-Processing)]] - Taken from physcomp serial section
Added lines 37-44:
[[Code.ThreshTrigger|Treshold-Based Trigger On/Off]]
[[Code.BandPassByAvg|Band-pass Filter by Average]]
[[Code.SimpleEdgeFinder|Auto-Finding Ranges of Analog Sensor, Percentage Sending]]
----
[[Code.BandPassByAvg|Band-pass Filter by Average]]
[[Code.SimpleEdgeFinder|Auto-Finding Ranges of Analog Sensor, Percentage Sending]]
----
Added lines 13-18:
[[Code.DosOnChipProcessingTom|DosOnChip Module Example (Processing)]]
[[Code.DosOnChipProcessingJeff|Another DosOnChip Module Example (Processing)]]
----
[[Code.DosOnChipProcessingJeff|Another DosOnChip Module Example (Processing)]]
----
Changed lines 15-16 from:
[[Code.OneSensorAvg|One Sensor Averaged (Arduino]]
to:
[[Code.OneSensorAvg|One Sensor Averaged (Arduino)]]
Added lines 15-16:
[[Code.OneSensorAvg|One Sensor Averaged (Arduino]]
Added lines 9-10:
[[Code.ToCompDatalogging|Simple Datalogging directly to Computer]]
Changed lines 7-8 from:
[[Code.4dSystemsByte|4dSystems xD Datalogger (Arduino-Processing)]] - Byte by Byte
to:
[[Code.4dSystemsByte|4dSystems xD Datalogger (Arduino-Processing)]]
Added lines 7-10:
[[Code.4dSystemsByte|4dSystems xD Datalogger (Arduino-Processing)]] - Byte by Byte
----
----
Added lines 15-16:
----
Added lines 19-20:
[[Code.spiWithoutInterrupts|Simple SPI Communication without AVR Interrupts]]
Added lines 15-16:
[[Code.simpleI2CCompass|Using i2c with the CMP103 Compass Module]]
Changed lines 17-19 from:
to:
'''External Code Resources'''
[[http://www.tigoe.net/pcomp/code/category/code/arduinowiring/140|Sensor Graphs in 3 Lines of Code + OSX Graph]]
[[http://www.tigoe.net/pcomp/code/category/code/arduinowiring/140|Sensor Graphs in 3 Lines of Code + OSX Graph]]
Added line 8:
Added line 10:
Added line 12:
Added line 14:
Added line 17:
Changed lines 8-10 from:
to:
[[Code.ThreeSensorsOneAvg|Three Sensors, one Averaged (Arduino-Processing)]]
[[Code.ThreeSensorsOneThresh|Three Sensors, one Threshold (Arduino-Processing)]]
[[Code.ThreeSensorsSetThresh|Three Sensors, one Threshold, two set Threshold (Arduino-Processing)]]
[[Code.ThreeSensorsOneThresh|Three Sensors, one Threshold (Arduino-Processing)]]
[[Code.ThreeSensorsSetThresh|Three Sensors, one Threshold, two set Threshold (Arduino-Processing)]]
Deleted lines 2-12:
\\
(:if auth edit:)
''Include code samples in the Code Wiki group, and they will be automatically posted here. Please sign and describe your code samples in the first 7 lines of the page. Comment and debug your code as much as possible before posting.'' \\
[[~tigoe]] & [[~jamie]]
(:if:)
\\
Added lines 7-10:
[[Code.ThreeSensors|Three Sensors (Arduino-Processing)]]
----
----
Changed line 18 from:
(:pagelist group=Code -Code.Code -Code.PageListTemplate count=10 list=normal fmt=template page=Code.PageListTemplate :)
to:
(:pagelist group=Code -Code.Code -Code.PageListTemplate count=100 list=normal fmt=template page=Code.PageListTemplate :)
Changed line 18 from:
(:pagelist group=Code -Code.Code -Code.PageListTemplate list=normal fmt=template page=Code.PageListTemplate :)
to:
(:pagelist group=Code -Code.Code -Code.PageListTemplate count=10 list=normal fmt=template page=Code.PageListTemplate :)
Changed line 18 from:
(:pagelist group=Code -Code.Code -Code.PageListTemplate fmt=template page=Code.PageListTemplate :)
to:
(:pagelist group=Code -Code.Code -Code.PageListTemplate list=normal fmt=template page=Code.PageListTemplate :)
Changed line 18 from:
(:pagelist group=Code -Code.Code -Code.PageListTemplate list=time fmt=template page=Code.PageListTemplate :)
to:
(:pagelist group=Code -Code.Code -Code.PageListTemplate fmt=template page=Code.PageListTemplate :)
Changed line 18 from:
(:pagelist group=Code -Code.Code -Code.PageListTemplate list=normal fmt=template page=Code.PageListTemplate :)
to:
(:pagelist group=Code -Code.Code -Code.PageListTemplate list=time fmt=template page=Code.PageListTemplate :)
Changed line 18 from:
(:pagelist group=Code -Code.Code -Code.PageListTemplate list=-time fmt=template page=Code.PageListTemplate :)
to:
(:pagelist group=Code -Code.Code -Code.PageListTemplate list=normal fmt=template page=Code.PageListTemplate :)
Changed line 18 from:
(:pagelist group=Code -Code.Code -Code.PageListTemplate list=normal fmt=template page=Code.PageListTemplate :)
to:
(:pagelist group=Code -Code.Code -Code.PageListTemplate list=-time fmt=template page=Code.PageListTemplate :)
Changed line 8 from:
''Include code samples in the ''Code" Wiki group, and they will be automatically posted here. Please sign and describe your code samples in the first 7 lines of the page. Comment and debug your code as much as possible before posting.'' \\
to:
''Include code samples in the Code Wiki group, and they will be automatically posted here. Please sign and describe your code samples in the first 7 lines of the page. Comment and debug your code as much as possible before posting.'' \\
Changed lines 1-2 from:
This page lists code samples from the sensor reports. There are also a few general examples here as well. All major pieces of code for the wiki should be linked here (if you include code samples in the ''Code" Wiki group, they will be automatically posted here). \\\
to:
This page lists code samples from the sensor reports. There are also a few general examples here as well. All major pieces of code for the wiki should be linked here. \\\
Changed line 8 from:
''Please sign and describe your code samples in the first 7 lines of the page. Comment and debug your code as much as possible before posting.'' \\
to:
''Include code samples in the ''Code" Wiki group, and they will be automatically posted here. Please sign and describe your code samples in the first 7 lines of the page. Comment and debug your code as much as possible before posting.'' \\
Changed lines 8-9 from:
''Please sign and describe your code samples in the first 7 lines of the page. Comment and debug your code as much as possible before posting! \\\
''\\
''
to:
''Please sign and describe your code samples in the first 7 lines of the page. Comment and debug your code as much as possible before posting.'' \\
Added line 15:
Deleted lines 2-3:
Changed lines 8-9 from:
''Please sign and describe your code samples in the first 7 lines of the page.''\\
to:
''Please sign and describe your code samples in the first 7 lines of the page. Comment and debug your code as much as possible before posting! \\\
''\\
''\\
Changed lines 1-4 from:
This page lists code samples from the sensor reports. There are also a few general examples here as well. All major pieces of code for the wiki should be linked here (if you include code samples in the ''Code" Wiki group, they will be automatically posted here).
Please comment and debug your code as much as possible before posting!
Please comment and debug your code as much as possible before posting!
to:
This page lists code samples from the sensor reports. There are also a few general examples here as well. All major pieces of code for the wiki should be linked here (if you include code samples in the ''Code" Wiki group, they will be automatically posted here). \\\
Please comment and debug your code as much as possible before posting! \\\
Please comment and debug your code as much as possible before posting! \\\
Changed lines 10-11 from:
''Please sign and describe your code samples in the first 7 lines of the page.\\
[[~tigoe]] & [[~jamie]]''
[[~tigoe]] & [[~jamie]]
to:
''Please sign and describe your code samples in the first 7 lines of the page.''\\
[[~tigoe]] & [[~jamie]]
[[~tigoe]] & [[~jamie]]
Changed lines 19-21 from:
(:pagelist group=Code -Code.Code -Code.PageListTemplate list=normal fmt=template page=Code.PageListTemplate :)
[[Code.Test]]
[[Code.Test]]
to:
(:pagelist group=Code -Code.Code -Code.PageListTemplate list=normal fmt=template page=Code.PageListTemplate :)
Changed lines 19-21 from:
(:pagelist group=Code -Code.Code -Code.PageListTemplate list=normal fmt=template page=Code.PageListTemplate :)
to:
(:pagelist group=Code -Code.Code -Code.PageListTemplate list=normal fmt=template page=Code.PageListTemplate :)
[[Code.Test]]
[[Code.Test]]
Changed lines 19-21 from:
(:pagelist group=Code -Code.Code -Code.PageListTemplate list=normal fmt=template page=Code.PageListTemplate :)
[[Code.Averaging]]
[[Code.Averaging]]
to:
(:pagelist group=Code -Code.Code -Code.PageListTemplate list=normal fmt=template page=Code.PageListTemplate :)
Changed lines 8-9 from:
''Everyone - please sign and describe your code samples in the first 7 lines of the page.\\
[[~tigoe]]''
[[~tigoe]]''
to:
''Please sign and describe your code samples in the first 7 lines of the page.\\
[[~tigoe]] & [[~jamie]]''
[[~tigoe]] & [[~jamie]]''
Changed lines 1-2 from:
This page lists code samples from the sensor reports. There are also a few general examples here as well. All major pieces of code for the wiki should be linked here. Please debug your code before posting!
to:
This page lists code samples from the sensor reports. There are also a few general examples here as well. All major pieces of code for the wiki should be linked here (if you include code samples in the ''Code" Wiki group, they will be automatically posted here).
Please comment and debug your code as much as possible before posting!
Please comment and debug your code as much as possible before posting!
Changed lines 1-2 from:
This page lists code samples from the sensor reports. There are also a few general examples here as well. All major pieces of code for the wiki should be linked here.
to:
This page lists code samples from the sensor reports. There are also a few general examples here as well. All major pieces of code for the wiki should be linked here. Please debug your code before posting!
Added lines 3-4:
Check the [[(Glossary.)Glossary]] page for links to some additional code examples offsite.
Added lines 14-15:
[[Code.Datalogger]]
Changed lines 1-2 from:
to:
This page lists code samples from the sensor reports. There are also a few general examples here as well. All major pieces of code for the wiki should be linked here.
Changed lines 1-2 from:
Code samples from the sensor reports
to:
Code samples from the sensor reports. There are also a few general examples here as well.
Changed line 2 from:
to:
(:if auth=edit :)
Changed lines 5-7 from:
to:
(:if:)
(:pagelist group=Code -Code.Code -Code.PageListTemplate list=normal fmt=template page=Code.PageListTemplate :)
(:pagelist group=Code -Code.Code -Code.PageListTemplate list=normal fmt=template page=Code.PageListTemplate :)
Changed line 7 from:
(:pagelist group=Code list=normal fmt=template page=Code.PageListTemplate :)
to:
(:pagelist group=Code -Code.Code list=normal fmt=template page=Code.PageListTemplate :)
Changed line 7 from:
(:pagelist group=Code list=normal fmt=template include=Code.PageListTemplate :)
to:
(:pagelist group=Code list=normal fmt=template page=Code.PageListTemplate :)
Changed line 7 from:
(:pagelist group=Code list=normal fmt=template include=PageListTemplate :)
to:
(:pagelist group=Code list=normal fmt=template include=Code.PageListTemplate :)
Changed line 7 from:
(:pagelist group=Code list=normal :)
to:
(:pagelist group=Code list=normal fmt=template include=PageListTemplate :)
Changed line 7 from:
(:pagelist group=Code list=normal)
to:
(:pagelist group=Code list=normal :)
Changed lines 7-11 from:
(:pagelist group=Code list=normal fmt=template page=Code.pageListTemplate:)
[[Code.dianeCode]]
[[Code.pageListTemplate]]
[[Code.dianeCode]]
[[Code.pageListTemplate]]
to:
(:pagelist group=Code list=normal)
Deleted lines 2-3:
Changed lines 9-11 from:
(:pagelist group=Code fmt=template page=Code.pageListTemplate list=normal:)
to:
(:pagelist group=Code list=normal fmt=template page=Code.pageListTemplate:)
Changed line 5 from:
''Everyone - please sign and comment your code samples.\\
to:
''Everyone - please sign and describe your code samples in the first 7 lines of the page.\\
Changed lines 9-11 from:
(:pagelist group=Code fmt=template page=Code.pageListTemplage list=normal:)
to:
(:pagelist group=Code fmt=template page=Code.pageListTemplate list=normal:)
Changed lines 9-11 from:
(:pagelist group=Code list=normal:)
to:
(:pagelist group=Code fmt=template page=Code.pageListTemplage list=normal:)
Deleted lines 11-17:
(:include {$PageList.Group}.{$PageList.Name} lines=5 group=Code:):)
(:if ! {$PageList.LastPage}:)
-----
(:if:)
Changed lines 14-15 from:
(:include {$PageList.Group}.{$PageList.Name} lines=5 group=-Test:):)
to:
(:include {$PageList.Group}.{$PageList.Name} lines=5 group=Code:):)
Changed lines 12-13 from:
to:
'''[[{$PageList.Group}.{$PageList.Name}]]''' - [[Edit -> {$PageList.Group}.{$PageList.Name}?action=edit]]
(:include {$PageList.Group}.{$PageList.Name} lines=5 group=-Test:):)
(:if ! {$PageList.LastPage}:)
-----
(:if:)
(:include {$PageList.Group}.{$PageList.Name} lines=5 group=-Test:):)
(:if ! {$PageList.LastPage}:)
-----
(:if:)
Changed lines 9-13 from:
(:pagelist group=Code list=normal include {$PageList.Group}.{$PageList.Name} lines=5 group=Code:)
to:
(:pagelist group=Code list=normal:)
Changed lines 9-20 from:
(:pagelist group=Code list=normal:)
|| '''[[{$PageList.Group}.{$PageList.Name}]]''' - [[Edit -> {$PageList.Group}.{$PageList.Name}?action=edit]]||
(:include {$PageList.Group}.{$PageList.Name} lines=5 group=Code:):)
(:if ! {$PageList.LastPage}:)
-----
(:if:)
|| '''[[
(
(:if ! {$PageList.LastPage}:)
-----
(:if:)
to:
(:pagelist group=Code list=normal include {$PageList.Group}.{$PageList.Name} lines=5 group=Code:)
Changed lines 13-14 from:
(:include {$PageList.Group}.{$PageList.Name} lines=5 group=-Test:):)
to:
(:include {$PageList.Group}.{$PageList.Name} lines=5 group=Code:):)
Changed lines 9-12 from:
(:pagelist group=Code fmt=dictindex list=normal:)
to:
(:pagelist group=Code list=normal:)
|| '''[[{$PageList.Group}.{$PageList.Name}]]''' - [[Edit -> {$PageList.Group}.{$PageList.Name}?action=edit]]||
(:include {$PageList.Group}.{$PageList.Name} lines=5 group=-Test:):)
(:if ! {$PageList.LastPage}:)
-----
(:if:)
|| '''[[{$PageList.Group}.{$PageList.Name}]]''' - [[Edit -> {$PageList.Group}.{$PageList.Name}?action=edit]]||
(:include {$PageList.Group}.{$PageList.Name} lines=5 group=-Test:):)
(:if ! {$PageList.LastPage}:)
-----
(:if:)
Changed lines 9-12 from:
(:pagelist group=Code fmt=dictindex:)
to:
(:pagelist group=Code fmt=dictindex list=normal:)
Changed lines 9-12 from:
(:pagelist group=Code fmt=dictindex list=normal:)
to:
(:pagelist group=Code fmt=dictindex:)
Changed lines 9-12 from:
(:pagelist group=Code list=normal:)
to:
(:pagelist group=Code fmt=dictindex list=normal:)
Changed lines 12-13 from:
to:
Changed lines 12-13 from:
(:pagelist group=Code include {$PageList.Group}.{$PageList.Name} lines=5 group=Code:)
to:
(:pagelist group=Code include {$PageList.Group}.{$PageList.Name} lines=5:)
Changed lines 12-13 from:
(:pagelist include {$PageList.Group}.{$PageList.Name} lines=5 group=Code:)
to:
(:pagelist group=Code include {$PageList.Group}.{$PageList.Name} lines=5 group=Code:)
Changed lines 12-13 from:
(:include {$PageList.Group}.{$PageList.Name} lines=5 group=Code:)
to:
(:pagelist include {$PageList.Group}.{$PageList.Name} lines=5 group=Code:)
Changed lines 12-13 from:
(:include {$PageList.Group}.{$PageList.Name} lines=5 group=Code:):)
to:
(:include {$PageList.Group}.{$PageList.Name} lines=5 group=Code:)
Changed lines 12-13 from:
(:include {$PageList.Group}.{$PageList.Name} lines=5 group=-Test:):)
to:
(:include {$PageList.Group}.{$PageList.Name} lines=5 group=Code:):)
Added lines 12-13:
(:include {$PageList.Group}.{$PageList.Name} lines=5 group=-Test:):)
Deleted lines 11-15:
(:if ! {$PageList.LastPage}:)
-----
(:if:)
Added lines 11-16:
(:include {$PageList.Group}.{$PageList.Name} lines=5 group=-Test:):)
(:if ! {$PageList.LastPage}:)
-----
(:if:)
Deleted lines 10-18:
|| '''[[{$PageList.Group}.{$PageList.Name}]]''' - [[Edit -> {$PageList.Group}.{$PageList.Name}?action=edit]]||
(:include {$PageList.Group}.{$PageList.Name} lines=5 group=-Test:):)
(:if ! {$PageList.LastPage}:)
-----
(:if:)
Added lines 11-19:
|| '''[[{$PageList.Group}.{$PageList.Name}]]''' - [[Edit -> {$PageList.Group}.{$PageList.Name}?action=edit]]||
(:include {$PageList.Group}.{$PageList.Name} lines=5 group=-Test:):)
(:if ! {$PageList.LastPage}:)
-----
(:if:)
Added lines 2-8:
''Diane- I gave the two-beam sensor its own page.''
''Everyone - please sign and comment your code samples.\\
[[~tigoe]]''
Deleted lines 10-11:
[[~tigoe]]''
Changed lines 5-7 from:
[[~tigoe]]''
to:
[[~tigoe]]''
Code.XportToNet
Code.XportToNet
Changed lines 4-5 from:
[[Code.TwoBeamSensor]]
to:
''Diane- I gave the two-beam sensor its own page\\
[[~tigoe]]''
[[~tigoe]]''
Deleted lines 2-51:
[[
'set photocell pin for input
'if photocell goes low, trigger the relays
' make test LED HIGH if resistance drops (trigger event -- make array calculations)
'This is the initial test code for the Though-beam sensor.
' 3 issues:
'1) photocell seems to acclimate to the intensity of the laser, electron activity falls off some.*see light history 'note above. intitial evaluation of "700 in DEC" would have to be lowered.
'2) lasers bout in ChinaTown have a very short life span--10 minutes. (tried two types)
'3) evaluating laser consistency burns out eye balls.
define ADC_CLOCK 3
define ADC_BITS 10
Define ADC_SAMPLEUS 20
define osc 4
ADCvar var word
PCell var porta.0
TestBlink var portc.4
output testblink
ADCON1 = %10000010
TRISA = %11111111
Tx var portc.6
high testblink 'testblink 2 times --stop
pause 200
low testblink
pause 200
high testblink
pause 200
low testblink
pause 200
main:
pcell = adcvar
adcin 0, adcvar
serout2 tx, 16468,["adcvar = ", dec adcvar, 10,13]
pause 200
if adcvar > 700 then 'if photocell light is blocked and voltage drops-
high testblink 'test light goes HIGH if beam is broken
else
low testblink
endif
goto main 'keep reading Pcell pin
]]
Changed lines 3-4 from:
to:
Code Sample for serial-read though-beam sensor. (dct231)
[[
'set photocell pin for input
'if photocell goes low, trigger the relays
' make test LED HIGH if resistance drops (trigger event -- make array calculations)
'This is the initial test code for the Though-beam sensor.
' 3 issues:
'1) photocell seems to acclimate to the intensity of the laser, electron activity falls off some.*see light history 'note above. intitial evaluation of "700 in DEC" would have to be lowered.
'2) lasers bout in ChinaTown have a very short life span--10 minutes. (tried two types)
'3) evaluating laser consistency burns out eye balls.
define ADC_CLOCK 3
define ADC_BITS 10
Define ADC_SAMPLEUS 20
define osc 4
ADCvar var word
PCell var porta.0
TestBlink var portc.4
output testblink
ADCON1 = %10000010
TRISA = %11111111
Tx var portc.6
high testblink 'testblink 2 times --stop
pause 200
low testblink
pause 200
high testblink
pause 200
low testblink
pause 200
main:
pcell = adcvar
adcin 0, adcvar
serout2 tx, 16468,["adcvar = ", dec adcvar, 10,13]
pause 200
if adcvar > 700 then 'if photocell light is blocked and voltage drops-
high testblink 'test light goes HIGH if beam is broken
else
low testblink
endif
goto main 'keep reading Pcell pin
]]
[[
'set photocell pin for input
'if photocell goes low, trigger the relays
' make test LED HIGH if resistance drops (trigger event -- make array calculations)
'This is the initial test code for the Though-beam sensor.
' 3 issues:
'1) photocell seems to acclimate to the intensity of the laser, electron activity falls off some.*see light history 'note above. intitial evaluation of "700 in DEC" would have to be lowered.
'2) lasers bout in ChinaTown have a very short life span--10 minutes. (tried two types)
'3) evaluating laser consistency burns out eye balls.
define ADC_CLOCK 3
define ADC_BITS 10
Define ADC_SAMPLEUS 20
define osc 4
ADCvar var word
PCell var porta.0
TestBlink var portc.4
output testblink
ADCON1 = %10000010
TRISA = %11111111
Tx var portc.6
high testblink 'testblink 2 times --stop
pause 200
low testblink
pause 200
high testblink
pause 200
low testblink
pause 200
main:
pcell = adcvar
adcin 0, adcvar
serout2 tx, 16468,["adcvar = ", dec adcvar, 10,13]
pause 200
if adcvar > 700 then 'if photocell light is blocked and voltage drops-
high testblink 'test light goes HIGH if beam is broken
else
low testblink
endif
goto main 'keep reading Pcell pin
]]
Deleted lines 4-38:
'for the QT140 and PIC 18F252
'Qprox 2... test sinking inputs of qprox and outputs to leds.
Define OSC 20 '20MHz oscillator
trisB = %00001111 'PORTB.0 - B.3 = input, B.4 - B.7 = output
loop:
IF PORTB.0 = 0 Then 'if the Q has sunk the pin
portB.4 = 0 'sink the led to light it
else
portB.4 = 1 'else take the pin high to turn the led off
endif
IF PortB.1 = 0 Then
portB.5 = 0
else
portB.5 = 1
endif
IF PortB.2 = 0 Then
portB.6 = 0
else
portB.6 = 1
endif
IF PortB.3 = 0 Then
portB.7 = 0
else
portB.7 = 1
endif
goto loop
end
]]
Changed lines 3-35 from:
to:
[[RichQproxTest
'Qprox 2... test sinking inputs of qprox and outputs to leds.
Define OSC 20 '20MHz oscillator
trisB = %00001111 'PORTB.0 - B.3 = input, B.4 - B.7 = output
loop:
IF PORTB.0 = 0 Then 'if the Q has sunk the pin
portB.4 = 0 'sink the led to light it
else
portB.4 = 1 'else take the pin high to turn the led off
endif
IF PortB.1 = 0 Then
portB.5 = 0
else
portB.5 = 1
endif
IF PortB.2 = 0 Then
portB.6 = 0
else
portB.6 = 1
endif
IF PortB.3 = 0 Then
portB.7 = 0
else
portB.7 = 1
endif
goto loop
end
]]
'Qprox 2... test sinking inputs of qprox and outputs to leds.
Define OSC 20 '20MHz oscillator
trisB = %00001111 'PORTB.0 - B.3 = input, B.4 - B.7 = output
loop:
IF PORTB.0 = 0 Then 'if the Q has sunk the pin
portB.4 = 0 'sink the led to light it
else
portB.4 = 1 'else take the pin high to turn the led off
endif
IF PortB.1 = 0 Then
portB.5 = 0
else
portB.5 = 1
endif
IF PortB.2 = 0 Then
portB.6 = 0
else
portB.6 = 1
endif
IF PortB.3 = 0 Then
portB.7 = 0
else
portB.7 = 1
endif
goto loop
end
]]
Deleted lines 3-5:
[[Code.TwoByteSender]]
[[Code.TwoByteReceiver]]
Changed lines 5-6 from:
[[Code.TwoByteSender]]
to:
[[Code.TwoByteSender]]
[[Code.TwoByteReceiver]]
[[Code.TwoByteReceiver]]
Changed lines 2-4 from:
(:pagelist group=Code list=normal:)
to:
(:pagelist group=Code list=normal:)
test
test
Changed line 2 from:
(:pagelist fmt=group:)
to:
(:pagelist group=Code list=normal:)
Added lines 1-2:
Code samples from the sensor reports
(:pagelist fmt=group:)
(:pagelist fmt=group:)