Shop OBEX P1 Docs P2 Docs Learn Events
controlling an alarm from javelin — Parallax Forums

controlling an alarm from javelin

coolbebecoolbebe Posts: 9
edited 2006-04-07 22:09 in General Discussion
I'm trying to control an alarm using a switch. It's part of the rfid inventory tracking system. what i want to do is·that when·a tag is detected by a reader the alarm should come off. I got the alram to come off when i'm detecting a tag but· i need the alarm to stop after 1 or 2 minutes i need some kind of timer. The other thing is that·i want when i place a deactivated tags by the reader i don't want the alarm to come off. this is the code i'm using:
Thank you


·static int v1 = 0;·· //ON
·static int v2 = 3;· //OFF

public static void main() {
·CPU.writePin(CPU.pin0,false);
·//· Timer t = new Timer();
···· Timer clock = new Timer();


·· while(true) { //loop forever
····· //wait for '\n'

····· while(true)· {

······· // if(rxUart.byteAvailable ()!=true)
········ // {
············ //· DAC p2 = new DAC(CPU.pin2);
············ //· p2.update(v2);
······ //·· }
·········· if (rxUart.byteAvailable())· {
··········· c=(char)rxUart.receiveByte();
··········· DAC p2 = new DAC( CPU.pin2);
··········· p2.update(v1);

······· }

··········· if (c=='\n') break;
····· }
····· //read 10 bytes and display
····· index=0;
····· while (index<10) {
······· if (rxUart.byteAvailable()) {
·········· c = (char)rxUart.receiveByte();
·········· System.out.print(c);
·········· index++;
······· }
····· }
····· System.out.print ('\n');


·· } //end loop forever
}

Comments

  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2006-04-07 22:09
    What you require is a sorted list of known tags, new tags are added to the list
    on the fly. The question is if you want these tags (eg. this list) only to exist
    while the javelin is powered (a list in ram will do then) or if you want
    this list permanently stored (in onboard or external eeprom) that can be
    restored after·the javelin powers up.
    Please specify.

    regards peter
Sign In or Register to comment.