Jump to content
43oh

Using Capacitive touch and Air Booster Pack Together


Recommended Posts

After finding the library code correction I got the demo programs for Energia Air Boosters to work. I'm perplexed on how I might use the capacitve touch and Air booster together. Looking at the Pin mapping J2 15 and 16 are a potential conflict. J1 pin 2 and 7 are conconflicts. would I excced fan in out fan out? Not sure home much current is been used. I good remote could be something like this: analog joystick with D/A and the a series of buttons. I think the buttons would be easy enough.

 

The sample program would just need to have more buttons added.

 

#include <SPI.h>
#include <AIR430BoostFCC.h>

// -----------------------------------------------------------------------------
/**
 *  Defines, enumerations, and structure definitions
 */

#define CMD_OFF         0
#define CMD_ON          1

/**
 *  sControl - control packet.
 */
struct sControl
{
  unsigned char cmd;
};

// -----------------------------------------------------------------------------
/**
 *  Global data
 */

struct sControl txControl = { CMD_OFF };      // TX control packet
struct sControl rxControl = { CMD_OFF };      // RX control packet

// -----------------------------------------------------------------------------
// Debug print functions

void printRxData()
{
  // Print the last received command to the serial port.
  Serial.print("RX Command: ");
  Serial.println(rxControl.cmd);
}

// -----------------------------------------------------------------------------
// Main example

void setup()
{
  // The radio library uses the SPI library internally, this call initializes
  // SPI/CSn and GDO0 lines. Also setup initial address, channel, and TX power.
  Radio.begin(0x01, CHANNEL_1, POWER_MAX);

  // Setup serial for debug printing.
  Serial.begin(9600);
 
  /**
   *  Setup LED for example demonstration purposes.
   *
   *  Note: Set radio first to ensure that GDO2 line isn't being driven by the
   *  MCU as it is an output from the radio.
   */
  pinMode(RED_LED, OUTPUT);
  digitalWrite(RED_LED, LOW);
 
  // Setup push button.
  pinMode(PUSH2, INPUT_PULLUP);
}

void loop()
{
  // Check for a button press. If the button is being pressed, load the txControl
  // into the radio TX FIFO and transmit it to the broadcast address.
  if (digitalRead(PUSH2) == LOW)
  {
    txControl.cmd = CMD_ON;
  }
  else
  {
    txControl.cmd = CMD_OFF;
  }
  Radio.transmit(ADDRESS_BROADCAST, (unsigned char*)&txControl, sizeof(txControl));
 
  /**
   *  The radio transmitter and receiver cannot be operated at the same time.
   *  Wait until transmit completes before turning on the receiver. Please note
   *  that the radio is considered busy when it is transmitting.
   *
   *  WARNING: If busy is not checked between two successive radio operations
   *  receiverOn/transmit, the radio may not perform the specified task. The
   *  radio must be complete with the transmission before it can begin the next
   */
  while (Radio.busy());
 
  // Turn on the receiver and listen for incoming data. Timeout after 1 seconds.
  // The receiverOn() method returns the number of bytes copied to rxData.
  if (Radio.receiverOn((unsigned char*)&rxControl, sizeof(rxControl), 1000) > 0)
  {
    // Perform action based on incoming command: turn on/off red LED.
    if (rxControl.cmd == CMD_ON)
    {
      digitalWrite(RED_LED, HIGH);
    }
    else
    {
      digitalWrite(RED_LED, LOW);
    }
    
    printRxData();                  // RX debug information
  }
}

 

 

Not sure how to add more buttons to this struct and then how to transmitt the analog or digital converted values. The temperature example probably has some clues in that direction.

  struct sControl
{
  unsigned char cmd;

};

 

Has anyone gotton the Air and capactive boost pack to work together. The Capacive touch sensor is a Joystick. and has buttons as well.

 

 

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...