CC3000 BoB UDP Client

Breakout boards, sensors, other Adafruit kits, etc.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
phinsil6
 
Posts: 6
Joined: Wed Mar 12, 2014 3:47 pm

CC3000 BoB UDP Client

Post by phinsil6 »

Hi,
I recently received the CC3000 BoB and am trying to port over arduino code that used to use an arduino ethernet shield for communicating on the network. However, the UDP related code doesn't seem to be working very well with the CC3000 library. So my question is, how do I set up the CC3000 in arduino to listen for incoming UDP packets? Basically I want it to listen for simple information passed in a UDP packet and then read that packet into a buffer, below is how i currently do it just fine:

Code: Select all

#include <SPI.h> 
#include <Ethernet.h>
#include <EthernetUdp.h>

byte mac[] = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
IPAddress ip(192, 168, 88, 200);
unsigned int localPort = 6001;  // local port to listen on
unsigned int RemotePort = 6000;
IPAddress RemoteIP;
char packetBuffer[UDP_TX_PACKET_MAX_SIZE]; //buffer to hold incoming packet,
EthernetUDP Udp;
int packetSize;

void setup()
{
  Serial.begin(57600);
  Ethernet.begin(mac,ip);
  Udp.begin(localPort);
}

void loop()
{
packetSize = Udp.parsePacket();
  if(packetSize)
  {
    RemoteIP = Udp.remoteIP();
    Udp.read(packetBuffer,UDP_TX_PACKET_MAX_SIZE); 
    command_udp();
  }
}

void command_udp()
{
  //parsing of packetBuffer
}

phinsil6
 
Posts: 6
Joined: Wed Mar 12, 2014 3:47 pm

Re: CC3000 BoB UDP Client

Post by phinsil6 »

anybody?

User avatar
adafruit_support_mike
 
Posts: 67446
Joined: Thu Feb 11, 2010 2:51 pm

Re: CC3000 BoB UDP Client

Post by adafruit_support_mike »

Take a look at the InternetTime and ntpTest sketches in the CC3000 library for examples of how to use UDP with the Adafruit_CC3000 library:

http://learn.adafruit.com/adafruit-cc30 ... ternettime
http://learn.adafruit.com/adafruit-cc3000-wifi/ntptest

Locked
Please be positive and constructive with your questions and comments.

Return to “Other Products from Adafruit”