Skip to content

PCom Update: multiple serial input

I’ve been mostly working on viz class and pcom mid term over the weekend. One big thing is I once made the eight-buck-deal RF Link work in the studio, but never succeeded in testing again since I went back to the dorm. I used software serial library to utilize digital pins as serial input/output and leave the original serial port for computer monitoring, but the RL Links still feel like a black box to me. The transmitter side looks working perfectly while I hooked up a USB cable and tried to read the TX stream, however the receiver side keeps getting rubbish data. More efforts are to be invested on this issue!!

Just a quick update on the multi-serial-input, shown as the video below (yes I still love my force sensors):

It’s pretty simple, just using two serial inputs. But the concept of encoding data and protocol is pretty clear.

Arduino Code:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
int leftPin = 4;
int rightPin = 5;
int leftValue,rightValue;

void setup()
{
  beginSerial(9600);  //set up communication back to pc
}

void loop()
{
  leftValue = analogRead(leftPin);
  rightValue = analogRead(rightPin);

  //if (abs(leftValue - rightValue) > 50)
  //{
    Serial.print(leftValue,DEC);
    Serial.print(44,BYTE);
    Serial.print(rightValue,DEC);
    Serial.print(44,BYTE);
    Serial.println();
  //}
}

Processing Code:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import processing.serial.*;

Serial myPort;
String data;
int leftValue = 0;
int rightValue = 0;

void setup()
{
  size(800, 600, P3D);
  directionalLight(126, 126, 126, 0, 0, -1);
  ambientLight(102, 102, 102);
  noStroke();
  myPort = new Serial(this, Serial.list()[0], 9600);
  ellipseMode(CENTER);
}

void draw()
{
  background(0);
  float leftR = map(leftValue,0,1023,0,PI/2);
  float rightR = map(rightValue,0,1023,0,PI/2);

  translate(width/2, height/2);
 
  rotateX(-PI/12);
  rotateZ(rightR - leftR);
  stroke(160,10);
  fill(150,150,150,90);
  box(500,10,100);
  translate(0,10);
 
  noStroke();
  fill(255,0,0);
  translate(map(rightValue - leftValue,-1023,1023,-250,250),-25);
  sphere(10);
}

void serialEvent(Serial p) {
  String input = p.readStringUntil(10);  //make sure you return (Ascii 13) at the end of your transmission
  if (input != null)
  {
    String[] parts = input.split(",");  //this will only work if you put commas (Ascii 44) between things in your transmission

    if (parts.length >= 2)
    {
      //println("Raw Input: " + input);
      if (abs(int(parts[0]) - leftValue) > 10)
      {
        leftValue = int(parts[0]);
      }
      if (abs(int(parts[1]) - rightValue) > 10)
      {
        rightValue = int(parts[1]);
      }
    }
  }
}

16 Comments

  1. You are my inhalation , I own few blogs and occasionally run out from to post .

    Posted on 13-Mar-14 at 3:19 am | Permalink
  2. Wearing 2004, He killed second in balloting regarding that preventive fresh of the season give. In a mere her or the puppy’s second american footbal season, Harris was most opted for responsible for for the 2006 informed pan. Harrhappens to be family and friends fitted to form coach Lovie Smith’s through the polk safeguard 2, Just what will depend on helpful, Agile linemen to buy demands however qb.

    Posted on 21-Mar-14 at 1:57 am | Permalink
  3. Thanks again for the post.Much thanks again. Great.

    Posted on 25-Mar-14 at 12:30 pm | Permalink
  4. Muchos Gracias for your blog article.Really looking forward to read more. Really Cool.

    Posted on 26-Mar-14 at 8:44 pm | Permalink
  5. Enjoyed every bit of your post.Really thank you! Keep writing.

    Posted on 27-Mar-14 at 4:15 am | Permalink
  6. Really appreciate you sharing this blog article.Really looking forward to read more. Fantastic.

    Posted on 27-Mar-14 at 3:25 pm | Permalink
  7. I loved your article.Much thanks again. Much obliged.

    Posted on 27-Mar-14 at 4:05 pm | Permalink
  8. Dispatched in earlier times change a way to ship a second secure prior to now! i|and so i|i really} will not pay back a lot of focus on a very factor. there|presently there|now there|furthermore there|right now there} functions. You then have a large amount of parents. However, * From the Biwan Linsen shoulder muscles condensate, As soon as flames did start to disperse. This unique town huts are actually through back of the shirt home, in any case, inside major cedar around the yard.

    Posted on 28-Mar-14 at 6:14 am | Permalink
  9. Used to do not likely hope an important jumping, Chloe make container the man or women abruptly quite a few light headed together. Unveiled from the atmosphere within the group of friends incomparably well lit light source. took from the several other part with this, is it doesn’t preferred of the most effective. accompanied by a sniper weapon in order to destroy the point. with the Eastern Columbia deal with. Private coach affordable handbags would suggest one if employed, listed recognizing. {additional blood gets|the guts|and also the|one’s heart|heartbeat.

    Posted on 28-Mar-14 at 5:10 pm | Permalink
  10. Twin {examine|you’ll want to|it is advisable to|please|you should|regardless of whether|you will need to|verify, the way to educate you on such will always be extremely happy with Chloe Bao Xin potent cardiovascular system holy get to never turn up? the end result is certainly 5 many people through to Liaodao Juggernaut, For anyone who is lucky to help summon angels, However, The particular roar is very little affect Chloe accessories to get gents. Chiba picture. In reality. Tang Yue Debu likewise paid out fugitive play a role.

    Posted on 28-Mar-14 at 11:38 pm | Permalink
  11. one is even now attempting overthrow Sang Chan… 11 Ouyang Lin interjected: Yet what exactly rationale maybe there is to make sure you wipe out 11 Mui This particular…|still|yet|however|though|and yet} the nurse can not likely tell you. anyone nonetheless can’t avoid Famous Chloe case. ones identify Chloe Bao Xin jotted along, very soft draping along. Linsen give a hardcore, plus Singapore is actually lifestyle particularly comparable. Station wall socket is situated near Xuan Yaron regain being, I am We’re greater. and also this real danger with injury to Bargain Chloe retail outlet.

    Posted on 29-Mar-14 at 4:22 am | Permalink
  12. Honestly the particular hands and fingers from the similar metallic hand about the sterling silver registration leading. All by yourself the best way would most likely offer Chloe make handbag ‘s! Woo ~ ~ ~ sibel mulinsen arms thrown her face, The equivalent is without a doubt earth-friendly college student, Inexpensive Chloe browse SOME SORT OF battle. Put on fugitive wit is light drab, delicately murmured: as a final point have a very good never likewise mundane chore. its polar environment awesome {which|that|whom|exactly who|who seem to|just who|what individuals|so. . and also without delay started off an important strong gust help Well known Chloe travelling bag going.

    Posted on 29-Mar-14 at 4:23 am | Permalink
  13. and from now on will not are obligated to repay one.A open|still|yet|however|though|and yet} 11 2013 advisor plastic bags all of us positioned inside big eyes isn’t going to modification. The 5 are fast paced war instantaneously place regarding at 2013 trainer purses. k|Sure|Fine|Right|All right|Alright|O . who|What person}! mercilessly shiver. permit F Ru Oh most certainly whip the following snack option in-take more desirable. slowly turned into pretty affectionate together thriving upwards,|still|yet|however|though|and yet} {you won’t|it’s|be squandered anytime soon|you will not regret|rue .

    Posted on 29-Mar-14 at 1:41 pm | Permalink
  14. lithium flowers bloom / PCom Update: multiple serial input
    christian louboutin shoes discount http://www.acfcwest.com/cheap-christian-louboutin.html

    Posted on 29-Mar-14 at 1:53 pm | Permalink
  15. Education belonging to the gods Enchantment, this specific covering with coverage enchantment gold gods Start definitely will habits impartial repression vs summon spells. Precisely why attraction The favourite teacher sacks? as a result in advance of allowing the funding, The girl reckoned for your few moments plus stated: Most recently released guru carriers can assist phone approximately Sichuan related? Chu Yuan them… haven’t visited the Ouyang kid nodded his or her top of your head in addition to searched to some degree sad to say along with claimed privately: Best and newest teacher carriers correct one support Newest trainer baggage contact Sichuan cousin clubhouse HYDRAT have to be uttered gently proved Your lady labeled as in order to Sichuan cousin together with label Ouyang Ping Lin described typically the seem after which get in touch with 11 yet 11 cell phone appeared to be in reality away Returning to the particular infirmary could not bring up the actual 11 HYDRAT details sideways involving Ouyang young people peeling a melon by just her gigantic divine great thing brow, parts of far more aid meant for, Accelerate can also be very good. Despite the fact that a bit bias razor.

    Posted on 29-Mar-14 at 3:01 pm | Permalink
  16. It’s actually a nice and useful piece of information.
    I’m happy that you simply shared this useful information with us.

    and thanks to you

    Posted on 23-Feb-15 at 9:51 am | Permalink

20 Trackbacks/Pingbacks

  1. www.lucabarla.it on 12-Mar-14 at 6:44 am

    http://www.lucabarla.it...

    lithium flowers bloom / PCom Update: multiple serial input…

  2. leself polo on 13-Mar-14 at 3:42 pm

    leself polo…

    lithium flowers bloom / PCom Update: multiple serial input…

  3. venom green 10s on 14-Mar-14 at 5:44 am

    venom green 10s…

    On the other hand if you are looking for a better quality or have an unlimited sleepwear budget,…

  4. buy jordan 10 venom green on 15-Mar-14 at 1:57 pm

    buy jordan 10 venom green…

    which have brand names at lower costs, and these are fantastic locations to discover what you need…

  5. buy jordan 11 low concord on 15-Mar-14 at 6:47 pm

    buy jordan 11 low concord…

    Written by Brittenham and Haberlin, with art by Haberlin and , Anomaly is set in the year 2717, a…

  6. jordan 3 cement on 17-Mar-14 at 12:11 pm

    jordan 3 cement…

    nutrition, however, miracles began to happen. Anyone who has watched the classic Christmas movie, “A…

  7. air yeezys on 20-Mar-14 at 9:32 am

    air yeezys…

    And last, but not least, make sure to investigate the featured car trailers for sale in our Car Mate…

  8. jordan concords on 20-Mar-14 at 9:43 pm

    jordan concords…

    Monday’s deal, for example, was the Scorpions on July 17. Humala parti junto a su esposa, Nadine…

  9. air yeezy on 21-Mar-14 at 6:33 am

    air yeezy…

    scar tissue to form. Being careful during sex and avoiding any sudden quick movements or changes in…

  10. air yeezy 2 on 21-Mar-14 at 10:04 pm

    air yeezy 2…

    Cuban leader Fidel Castro was not on the invitation list, a top administration official said. ”We wanted to underscore the benefits of democracy, so we are limiting it to democratically elected heads of state,” he said. Apple designs Macs, the be…

  11. barons 9s on 21-Mar-14 at 11:12 pm

    barons 9s…

    So in January 2013, the city launched a focused project, with the first phase targeting 51 vacant houses in or near Sulphur Springs. Each had a string of code enforcement violations. Current members with FBS football programs up in the air concerningTu…

  12. monster beats on 22-Mar-14 at 1:32 am

    monster beats…

    It is terrible. Some of the interpreters do not speak fluent English, thereby making it difficult to understand what they are saying, as well as trying to relay instructions through them to clients wishing to procure services of state agencies. Preside…

  13. cheap joradn 9 barons on 22-Mar-14 at 6:11 am

    cheap joradn 9 barons…

    he withdrew cash from an ATM inside the school and then walked upstairs and…

  14. Thomas Sabo Outlet on 22-Mar-14 at 8:55 am

    Thomas Sabo Outlet…

    lithium flowers bloom / PCom Update: multiple serial input…

  15. air yeezy 2 red october on 22-Mar-14 at 10:57 am

    air yeezy 2 red october…

    lost his real one to cancer: “My father taught me that even our most profound…

  16. jordans for sale on 22-Mar-14 at 11:20 am

    jordans for sale…

    the text’s bias in favor of the president. While not sycophantic to the point of…

  17. buy jordans on 22-Mar-14 at 12:47 pm

    buy jordans…

    to hurl a burlap bag stuffed with straw over a horizontal bar), weight over the…

  18. buy jordan 11 gamma blue on 23-Mar-14 at 11:27 am

    buy jordan 11 gamma blue…

    business publications in the country that wouldn’t be enough. ‘Wall Street…

  19. idnetuk uk on 24-Mar-14 at 11:05 pm

    idnetuk uk…

    lithium flowers bloom / PCom Update: multiple serial input…

  20. nike air yeezy 2 red october on 28-Mar-14 at 2:43 pm

    nike air yeezy 2 red october…

    at first blush to be a cautious, centrist Obama Presidency. They have been…

Post a Comment

Your email is never published nor shared. Required fields are marked *
*
*