ProMicro not behaving the same as an UNO

For the discussion of Arduino related topics.

Moderator: phalanx

ProMicro not behaving the same as an UNO

Postby Inquisitor » Fri Apr 13, 2012 11:39 am

I’ve received two of the ProMicro boards (DEV-11098). I've read through all the verbiage I can find on the ProMicro, the comments and the Getting Started. I've also read the readme.txt that came with the ProMicroDriver. I am successfully uploading and running programs from Windows 7 Ultimate x64.

I have a very simple Arduino sketch that sends some text every second using Serial.println(). Uploading, running and viewing the output on the Serial Monitor works for both an Arduino UNO and this ProMicro board. In both cases the sending LED on the UNO/ProMicro blinks and the text is displayed on the Serial Monitor every second. Everything is beautiful in the world!

Now, I have both the UNO and ProMicro boards loaded with the application and the Arduino IDE is closed.

I also have a simple C#.NET application that connects to a serial port and reads and displays anything coming over the port.

If I plug in the Arduino UNO board with the USB cable and then start the C# program the program immediately hooks up and the text from the UNO starts displaying from the C# program as I would expect and, again, the sending LED is blinking in sync with the sent Serial.println() calls.

However…

…when using the ProMicro, I have a problem. Hooking up the USB and then starting the C# program, it doesn’t work. Stepping through in the Visual Studio debugger, it successfully opens the port and calls the first ReadLine() and then blocks. Also the ProMicro send LED does not blink. I’ve attached both the sketch and C# program.

Since the output works on both boards with the Arduino IDE, and it works with the UNO with the C# program, I feel like it must be some other configuration or handshaking or something that the ProMicro needs in addition, but I don’t know what to try next.

I'm hoping it’s something obvious to someone here.
Thanks for any help.

ARDUINO SKETCH
Code: Select all
 
int VERSION = 1;
int SAMPLE_MS = 1000;
 
void setup()
{
  Serial.begin(9600);
  Serial.print("DAB Start Version,");
  Serial.println(VERSION);
}
 
void loop()
{
  Serial.print(GetTemperature());
  Serial.print(",");
  Serial.println(GetHumid());
  delay(SAMPLE_MS);                                     
}
 
void serialEvent()
{
  // We're using a single character to signify something to do.
  while(Serial.available())
  {
    char c = (char)Serial.read();
    switch(c)
    {
      case '0':
        Serial.println("Reset");
        break;
    }
  }
}
 
float GetTemperature()
{
  return GetCyclic(15.0, 27.0, 101);
}
 
float GetHumid()
{
  return GetCyclic(40.0, 50.0, 60);
}
 
float GetCyclic(float fMin, float fMax, int samplesPerPeriod)
{
  static int last = 0;
  float rad = last * 6.283185 / samplesPerPeriod;
  double rtn = (sin(rad) * (fMax - fMin) + fMax + fMin) / 2.0;
  last++;
  return (float)rtn;
}


C#.NET Code

Code: Select all
static void Main()
{
  SerialPort _sp = new SerialPort();
  _sp.PortName = "COM5";
  _sp.BaudRate = 9600;
  _sp.Parity = Parity.None;
  _sp.DataBits = 8;
  _sp.StopBits = StopBits.One;
  _sp.Handshake = Handshake.None;
  _sp.Open();

  while (true)
  {
    string message = _sp.ReadLine();
    Display(message);
  }
}
Inquisitor
 
Posts: 2
Joined: Fri Apr 13, 2012 10:40 am


Return to Arduino

Who is online

Users browsing this forum: Google [Bot] and 5 guests