Skip to main content
added 223 characters in body
Source Link

I was trying to communicate with my arduino uno over the serial connection from the USB. Connecting to it is usually not a problem, but what buggs me is the first transaction of the data... No matter with what I do it, java code or the serial monitor which comes with the IDE, I always have the problem that usually only one Byte is being transfered or received from the Arduino. What could be the problem? Is it just a bug and I have to live with it or can this somehow be fixed?

My Arduino Code:

#include "RGBdriver.h"
#define CLK 10
#define DIN 11

RGBdriver driver(CLK, DIN);
byte red = 45;0;
byte green = 18;0;
byte blue = 200;0;

byte newRed = 0;
byte newGreen = 0;
byte newBlue = 255;

void setup() {
  Serial.begin(9600);
}

void loop() {
  if (Serial.available() >= 3) {
    rednewRed = Serial.read();
    greennewGreen = Serial.read();
    bluenewBlue = Serial.read();
  } 

  
 if ((red delay!= newRed) || (50green != newGreen); || (blue != newBlue)) {
    red = newRed;
    green = newGreen;
    blue = newBlue;
    
    driver.begin();
    driver.SetColor(red, green, blue);
    driver.end();
  delay(50);}
}

I was trying to communicate with my arduino uno over the serial connection from the USB. Connecting to it is usually not a problem, but what buggs me is the first transaction of the data... No matter with what I do it, java code or the serial monitor which comes with the IDE, I always have the problem that usually only one Byte is being transfered or received from the Arduino. What could be the problem? Is it just a bug and I have to live with it or can this somehow be fixed?

My Arduino Code:

#include "RGBdriver.h"
#define CLK 10
#define DIN 11

RGBdriver driver(CLK, DIN);
byte red = 45;
byte green = 18;
byte blue = 200;

void setup() {
  Serial.begin(9600);
}

void loop() {
  if (Serial.available()) {
    red = Serial.read();
    green = Serial.read();
    blue = Serial.read();
  }
  
   delay(50);
  driver.begin();
  driver.SetColor(red, green, blue);
  driver.end();
  delay(50);
}

I was trying to communicate with my arduino uno over the serial connection from the USB. Connecting to it is usually not a problem, but what buggs me is the first transaction of the data... No matter with what I do it, java code or the serial monitor which comes with the IDE, I always have the problem that usually only one Byte is being transfered or received from the Arduino. What could be the problem? Is it just a bug and I have to live with it or can this somehow be fixed?

My Arduino Code:

#include "RGBdriver.h"
#define CLK 10
#define DIN 11

RGBdriver driver(CLK, DIN);
byte red = 0;
byte green = 0;
byte blue = 0;

byte newRed = 0;
byte newGreen = 0;
byte newBlue = 255;

void setup() {
  Serial.begin(9600);
}

void loop() {
  if (Serial.available() >= 3) {
    newRed = Serial.read();
    newGreen = Serial.read();
    newBlue = Serial.read();
  } 

  if ((red != newRed) || (green != newGreen) || (blue != newBlue)) {
    red = newRed;
    green = newGreen;
    blue = newBlue;
    
    driver.begin();
    driver.SetColor(red, green, blue);
    driver.end();
  }
}
Source Link

Serial Connection

I was trying to communicate with my arduino uno over the serial connection from the USB. Connecting to it is usually not a problem, but what buggs me is the first transaction of the data... No matter with what I do it, java code or the serial monitor which comes with the IDE, I always have the problem that usually only one Byte is being transfered or received from the Arduino. What could be the problem? Is it just a bug and I have to live with it or can this somehow be fixed?

My Arduino Code:

#include "RGBdriver.h"
#define CLK 10
#define DIN 11

RGBdriver driver(CLK, DIN);
byte red = 45;
byte green = 18;
byte blue = 200;

void setup() {
  Serial.begin(9600);
}

void loop() {
  if (Serial.available()) {
    red = Serial.read();
    green = Serial.read();
    blue = Serial.read();
  }
  
  delay(50);
  driver.begin();
  driver.SetColor(red, green, blue);
  driver.end();
  delay(50);
}