Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - Wayne

Pages: [1]
Ok, on the other computer, here is the send code

Code: [Select]
#include "SimbleeCOM.h"

uint8_t buttonA = 5;
char nodeA[] = {'1'};
uint8_t buttonB = 6;
char nodeB[] = {'2'};

void setup() {
  pinMode(buttonA, INPUT);
  pinMode(buttonB, INPUT);
  SimbleeCOM.mode = LOW_LATENCY;
  printf("The factory assigned ESN for this Simblee is: 0x%08x\n", SimbleeCOM.getESN());

void loop() {

   if (digitalRead(buttonA))
    SimbleeCOM.send(nodeA, sizeof(nodeA));
  if (digitalRead(buttonB))
    SimbleeCOM.send(nodeB, sizeof(nodeB));
  // SimbleeCOM.send(payload, sizeof(payload));

I have assigned buttons as "1", "2" as signals for send. These end up as mode ( changes workstation modes) and Xray (this has 2 closures)
I mimic this by RED led for mode and GREEN and BLUE led's for Xray and Security.

I ended up using Switch Case to read the byte code.

1st part of code:
Code: [Select]
#include "SimbleeCOM.h"
int button = 0;
int mode_led = 2;
int xray_led = 3;
int security_led = 4;

2nd part.. Setup   

Code: [Select]
void setup() {
  SimbleeCOM.mode = LOW_LATENCY;
  printf("The factory assigned ESN for this Simblee is: 0x%08x\n", SimbleeCOM.getESN());
  pinMode(mode_led, OUTPUT);
  pinMode(xray_led, OUTPUT);
  pinMode(security_led, OUTPUT);

The void loop has to take care of turning off the LEDs. Still working out how to make faster, but for testing.. good enuf

Code: [Select]
void loop() {

  if (button == 0)
    digitalWrite(mode_led, LOW);
    digitalWrite(xray_led, LOW);
    digitalWrite(security_led, LOW);

Now the bulk..
Thanks to RFD_Nelson for pointers..

Code: [Select]
void SimbleeCOM_onReceive(unsigned int esn, const char *payload, int len, int rssi)

  printf("%d ", rssi);
  printf("0x%08x ", esn);
  // for (int i = 0; i < len; i++)
  // printf("%02x ", byte (payload[0]));
  button = byte (payload[0]);

  switch (button)
    case 49:        // mode only
      //     Serial.println("its mode");
      digitalWrite(mode_led, HIGH);


    case 50:        // x-ray with security
      //    Serial.println("X-ray and Security");
      digitalWrite(xray_led, HIGH); digitalWrite(security_led, HIGH);
  button = 0;


on recv, read in payload as a byte..set var button to its value.. number please for switch case

on the case of 49 ("1") recv, lite RED led
on case 50 ("2") recv, lite both Blue and Green leds

all done, button to zero.

This is the recv..  I will post the send if you like.


Ok, I have learn that the SimbleeCOM.mode has to be in both the send and recv.  Done and works.

I have now change the payload of the sketch to work with buttons assignments and will attempt to light led's

This to mimic the easiest system.

How can I bond or link these together so to lockdown that other stuff can't sniff or interfere.


Will this work connected to another Simblee as a host.

I might need to send you a rough draft of the project because we will need bonding (some type of security) and signal of button/pedals that mimic the action of the buttons or pedal.
Like if it is depress, send the signal until released.

Been trying some examples now and changing as I go.

I thought com was related to apps like on iPhone and Android.

Guess I was thinking mobile..

RFD_Nelson, can you check to see if SimbleeCOM.mode = LOW_LATENCY; works.  The .mode part is black type, while the SimbleeCOM is red.
The line that says SimbleeCOM.send is all red..

Yes I will have some questions. 

I would like to have like 2 or 3 devices to 1 host.

The host will drive relays..

The devices will send button presses.  Min of 3, max of 8.. Different configurations.

I have been in contact with a Patty Steiman on this.

but suggestions will help since this is new to me.

I'm planning on using either of the 2 products in a new production of our current Wireless (Bluetooth RN42) product. Actually it is a 3rd version since introduction, but thats on the sales side.

What we do is mimic a medical footswitch and or handset unit using BT.
The actions are (depends of the x-ray system) Save or mode (save being a one time pulse per press) and or X-ray or Hi-Level x-ray (these use a security closure as well).
I have written code using arduino under the Teensy devices.  All pass are are out in the field.
Yes, we need to certify these, but in time. 

Reason the newer system is for battery use.  We want to get away from chargers and Li-Ion batteries which currently we need to go through hoops to qualify.
Also, the RN42 and current system kills batteries in less than 40 hrs.

Le can now use alkaline batteries and not worry over Fedex issues.  And low power is also a nice item (need less that 20ft.)
Our current BT module setup is 1 for FS, 1 for HS and 2 for the receiver.

If I understand correctly, I could make one unit Simblee or RFDuino a Master or central ?? and the other as slave or peripheral ??

Since the HS and FS mimic each other.

Since I do not have my stuff yet (kits and all), I like to find how to connect the units easily for production.
We program the FS/HS under one freescale and the recvr on another. The other programmers had selections for functions etc.
They can flip banks of switches to do certain functions, but most important is getting the BT modules to talk. When the link, the BT led lites.  They do FS first and then HS next to the recvr.

I'm hoping I can do this and lock out other BT devices. 

If someone can point me to where to look so I can start thinking on how to program it, be great.

And if I recall, the devices have AES security.. But if we lock it down, should be good too..

Pages: [1]