Skip to Content
Hardware Hacking Projects for Geeks
book

Hardware Hacking Projects for Geeks

by Scott Fullam
January 2004
Intermediate to advanced
348 pages
13h 33m
English
O'Reilly Media, Inc.
Content preview from Hardware Hacking Projects for Geeks
191
Chapter 9, How to Build a Cubicle Intrusion Detection System
Exhibit C: BasicStamp2 Software
This software counts the number of times the laser beam has been interrupted, updates the LCD with
this information, and looks for reset button events.
‘{$STAMP BS2}
Button1 VAR Byte
trip_count VAR Byte
N9600 con $4054
I con 254
CLR con 1
LINE2 con 192
L2_C1 con 135
L2_C7 con 199
‘ cube intrusion system version 1.0
‘ 5/12/02
‘ Scott Fullam
Gosub Init_Pins
Gosub Init_LCD
Start:
Gosub Scan_button
if IN1 = 0 then Start
out15 = 1
read 0, trip_count
trip_count = trip_count + 1
write 0, trip_count
serout 0,n9600,[I,LINE2]
serout 0,n9600,[“Count:”]
serout 0,n9600,[I,L2_C7]
serout 0,n9600,[DEC trip_count, “ “]
pause 1000
fall_laser:
if in1 = 1 then fall_laser
out15 = 0
Goto Start
Init_Pins:
Input 1
input 2
output 15
output 0
out15 = 0
return
Exhibit C
ch09_cube.indd 191
1/13/2002 4:14:51 PM
192
Part II: Advanced Hacks, Tools, and Techniques
Init_LCD:
pause 1000
serout 0,n9600,[I,CLR]
pause 1
serout 0,n9600,[“Cubemon 1.0”]
return
Scan_button:
‘ the button used is normall closed and will open up when pressed
if IN2 = 0 then end_state
trip_count = 0
write 0,trip_count
serout 0,n9600,[I,LINE2]
serout 0,n9600,[“Count:”]
serout 0,n9600,[I,L2_C7]
serout 0,n9600,[DEC trip_count, “ “]
end_state:
Return
Exhibit C
BasicStamp2 Software (continued) ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

Home Hacking Projects for Geeks

Home Hacking Projects for Geeks

Eric Faulkner, Tony Northrup

Publisher Resources

ISBN: 0596003145Catalog PageErrata