Controlling ligh..ts with teensy 2.0 and USB

So i want to make hook a teensy to a 5v relay or well a 16 relay board.

I was hoping to have it setup to where I can use a raspberry pi or another SBC to send commands to the teensy.

Like pin 1 on pin 1 off, to make the relays turn on and off at speed.



I have used teensy before for HID stuff, but never to control pins like this.

Any help is appreciated..

honestly a serial port that just listens for a pin number, or multiple pin numbers and changes the state of said pins would be fine.

Thanks in advance.
 
honestly a serial port that just listens for a pin number, or multiple pin numbers and changes the state of said pins would be fine.

Maybe this gives you a head start:
Code:
void setup()
{
  for (int i = 0; i < 3; i++)
  {
    pinMode(i, OUTPUT);
  }
}

void loop()
{
  if (Serial.available())
  {
    switch (Serial.read())
    {
    case '0':
      digitalToggleFast(0);
      break;

    case '1':
      digitalToggleFast(1);
      break;

    case '2':
      digitalToggleFast(2);
      break;

    default:
      break;
    }
  }
}
 
Did Paul make the same digitalToggle() changes to Teensy2's? If the digitalToggleFast() doesn't work try the digitalToggle().
 
Back
Top