| 
  • If you are citizen of an European Union member nation, you may not use this service unless you are at least 16 years old.

  • You already know Dokkio is an AI-powered assistant to organize & manage your digital files & messages. Very soon, Dokkio will support Outlook as well as One Drive. Check it out today!

View
 

X10RcxSignalAnalyzerCode

Page history last edited by PBworks 18 years, 7 months ago

Here's some example code to drive the X10RcxSignalAnalyzer.

 

There's all of thirty minutes of coding invested here, so my sensitivities will not be offended if you have an improvement to offer...

 

RCX Program

 

Here's the RCX-side logging code for the X10RcxSignalAnalyzer.

int c;

int last;

int init;

task main()

{

c=0;

init=0;

CreateDatalog(100);

ClearTimer(0);

last = Timer(0);

SetSensor(SENSOR_1,SENSOR_TOUCH);

while (true) {

if (SENSOR_1 == 1) {

c = c + 1;

PlayTone(440,50);

if (!init) {

AddToDatalog(0);

init = 1;

} else {

AddToDatalog(Timer(0)-last);

}

last = Timer(0);

Wait(300);

}

}

}

 

The wait time, which is 3 seconds (300) in my example, is to prevent multiple triggers by the client program.

The first time collected by the log will be zero.

 

To read the datalog back out, use "nqc -datalog".

 

Client Program

 

Here is a tiny client program to drive the X10RcxSignalAnalyzer

 

I'm sure there is a simple client that is capable of driving both the CM11A and CM17A, however, from what I found, BottleRocket appeared to be good way to drive the CM17A and Heyu a good way to drive the CM11A. I've had fun with MisterHouse but for driving a piece of test gear it's a little on the complex side!

 

Set the UM506 to the same code you select below (P3 in my example)

 

#!/usr/bin/perl

foreach $i (1..50) {

print "$i\n";

sleep(6);

#system("br P3 on");

system("heyu on P3");

}

 

You'll want the delay in the 'sleep' command to be somewhat longer than the wait time in the X10SignalAnalyzerCode. I played around with a few values and found six seconds for the client and three seconds for the signal analyzer to work ok.

Comments (0)

You don't have permission to comment on this page.