Post Reply 
 
Thread Rating:
  • 1 Votes - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
My implementations
10-13-2015, 05:05 PM
Post: #21
RE: My implementations
(10-13-2015 12:20 PM)vlelectronic Wrote:  You can see the battery voltage on smartphones?
Yes. You can see voltage as digits and/or voltage as fadder
Code:
// test for delay times
// In OSC layout add fadder3  
void setup()
{
   Serial1.begin(115200);
   Serial1.println("AT+RST");    
   delay(2000);
   Serial1.println("AT+CWMODE=3");
   delay(1000);
   //Serial1.println("AT+CIPMUX=1");
   Serial1.println("AT+CIPMUX=0");
   delay(1000);
   Serial1.println("AT+CIPMODE=0");
   delay(1000);
   Serial1.println("AT+CIPSTART=\"UDP\",\"192.168.4.2\",9001,9000,0");//9001 out, 9000 in.
   //AT+CIPSTART=1,"UDP","192.168.4.2",9001,9000,0
   delay(1000);

}
void loop()
{
sendToOSC("/1/fader3", battery);// float battery,
}

void sendToOSC(char* adr, float val)
{
// message like this ..... /1/adress/  ,f  xxxx
   Serial1.println("AT+CIPSEND=20");
    Serial1.print(adr);
   if (adr == "/1/fader1" || adr == "/1/push1" || adr == "/1/toggle1") {
     int cnt = 12 - strlen(adr);
     for (int i = 0; i < cnt; i++)  Serial1.write(0x00);
     Serial1.write(",f");
     Serial1.write(0x00);
     Serial1.write(0x00);
     byte * b = (byte *) &val;
     Serial1.write(b[3]);
     Serial1.write(b[2]);
     Serial1.write(b[1]);
     Serial1.write(b[0]);
   }
}
//send command to  /1/label ,for battery level in digits

[Image: Screenshot_2015_10_04_16_15_55.png]
Find all posts by this user
Quote this message in a reply
10-13-2015, 05:27 PM (This post was last modified: 10-13-2015 05:30 PM by KomX.)
Post: #22
RE: My implementations
(10-13-2015 05:05 PM)sasa999 Wrote:  [Image: Screenshot_2015_10_04_16_15_55.png]
Ай, спасибочки за код, господин хороший!
Ещё бы немного кода обрабатывающего команды: "HA-HA", "PIRUET", "DANCE", "TURN", "REV".

И хотелось бы взглянуть на 2 скрытых экрана.
Find all posts by this user
Quote this message in a reply
10-13-2015, 06:24 PM (This post was last modified: 10-13-2015 06:43 PM by sasa999.)
Post: #23
RE: My implementations
(10-13-2015 05:27 PM)KomX Wrote:  Ещё бы немного кода обрабатывающего команды: "HA-HA", "PIRUET", "DANCE", "TURN", "REV".
И хотелось бы взглянуть на 2 скрытых экрана.

Sad I tried attach *.touchosc file, but something is wrong with attachements Sad
got this "•The type of file that you attached is not allowed. Please remove the attachment or choose a different type."

Code - nothing serious - just for fun.

haha - just haos Smile
Code:
#include <Wtv020sd16p.h>
void Haha()
{
  for (uint8_t i = 0 ; i < 8; i++)
  {
    unsigned long timeHaha = millis();
//    if (VOICE && !digitalRead(busyPin)) wtv020sd16p.playVoice(haha);
    if (timeHaha - timePrev < 100)
    {
      throttle = THROTTLE_HAHA;
    }
    if (timeHaha - timePrev > 100 && timeHaha - timePrev < 200  )
    {
      throttle = -THROTTLE_HAHA;
    }
    if (timeHaha - timePrev > 200)
    {
      throttle = 0;
      steering = 0;
      timePrev = timeHaha ;
      haha2Start = 1;
      hahaStart = 0;
    }
  }
}
//-------------
void Haha2()
{
  for (uint8_t i = 0 ; i < 8; i++)
  {
    unsigned long  timeHaha2 = millis();
//    if (VOICE && !digitalRead(busyPin)) wtv020sd16p.playVoice(haha);
    if (timeHaha2 - timePrev < 100)
    {
      steering = STEERING_HA;
    }
    if (timeHaha2 - timePrev > 100 && timeHaha2 - timePrev < 200  )
    {
      steering = -STEERING_HA;
    }
    if (timeHaha2 - timePrev > 200)
    {
      throttle = 0;
      steering = 0;
      timePrev = timeHaha2 ;
      haha2Start = 0;
      hahaStart = 1;
    }
  }
}

piruet - just rotation at max possible speed
Code:
void Piruet()
{
  unsigned long timePiruet = millis();
  if (timePiruet - timePrev > 50)
  {
    if (!piruetEnding)
    {
      steering = piruetSteering;
      timePrev = timePiruet;
      piruetSteering += 15;
      if (piruetSteering > MAX_PIRUET_STEERING) piruetEnding = 1;
    }
    else
    {
      steering = piruetSteering;
      timePrev = timePiruet;
      piruetSteering -= 15;
      if (piruetSteering < 0)

      {
        steering = 0.0;
        piruetSteering = 0.0;
        piruetStart = 0;
        piruetEnding = 0;
        actionStart = 0;
      }
    }
  }
}

dance = 1 - 2 - cha-cha-cha
Code:
int8_t chacha1[] = { -1, 0, 0, 0, 1, 0, 0, 0, -1, 0, 1, 0, -1, 0, 0, 0};
int8_t chacha2[] = {  1, 0, 0, 0, -1, 0, 0, 0, 1, 0, -1, 0, 1, 0, 0, 0};
void Dance()
{
  unsigned long timeDance = millis();
  if (timeDance - timePrev > stepLenght)
  {
    steering = DANCE_STEERING * chacha1[cnt];
    timePrev = timeDance;
    cnt++;
  }
  if (cnt > 15)
  {
    cnt = 0;
    danceStart = 0;
    steering = 0.0;
    finalStart = 1;
  }
}


Turn - just turn without steering fadder
REV - change front and back , motor = -motor
Stop - set all to zero or neutral and reset fadders on OSC (if not used AutiReset function from OSC TouchMessages (/z)))
On/Off - wake-up and rise-up robot
Toggle buttons 1, 2 and 3 (at top) for speak, lights utc. I often use them for testing different codes/modes/setiings ...
You can see them all at video Smile
Find all posts by this user
Quote this message in a reply
10-13-2015, 06:56 PM
Post: #24
RE: My implementations
Hello Sasa 999,
Try changing the extension from BROBOT.touchosc to BROBOT.txt, you can also attach the file .ino?
regards Vito
Find all posts by this user
Quote this message in a reply
10-13-2015, 06:58 PM (This post was last modified: 10-13-2015 06:58 PM by KomX.)
Post: #25
RE: My implementations
(10-13-2015 06:24 PM)sasa999 Wrote:  
(10-13-2015 05:27 PM)KomX Wrote:  Ещё бы немного кода обрабатывающего команды: "HA-HA", "PIRUET", "DANCE", "TURN", "REV".
И хотелось бы взглянуть на 2 скрытых экрана.

Sad I tried attach *.touchosc file, but something is wrong with attachements Sad
got this "•The type of file that you attached is not allowed. Please remove the attachment or choose a different type."

Code - nothing serious - just for fun.

haha - just haos Smile
Code:
#include <Wtv020sd16p.h>
void Haha()
{
  for (uint8_t i = 0 ; i < 8; i++)
  {
    unsigned long timeHaha = millis();
//    if (VOICE && !digitalRead(busyPin)) wtv020sd16p.playVoice(haha);
    if (timeHaha - timePrev < 100)
    {
      throttle = THROTTLE_HAHA;
    }
    if (timeHaha - timePrev > 100 && timeHaha - timePrev < 200  )
    {
      throttle = -THROTTLE_HAHA;
    }
    if (timeHaha - timePrev > 200)
    {
      throttle = 0;
      steering = 0;
      timePrev = timeHaha ;
      haha2Start = 1;
      hahaStart = 0;
    }
  }
}
//-------------
void Haha2()
{
  for (uint8_t i = 0 ; i < 8; i++)
  {
    unsigned long  timeHaha2 = millis();
//    if (VOICE && !digitalRead(busyPin)) wtv020sd16p.playVoice(haha);
    if (timeHaha2 - timePrev < 100)
    {
      steering = STEERING_HA;
    }
    if (timeHaha2 - timePrev > 100 && timeHaha2 - timePrev < 200  )
    {
      steering = -STEERING_HA;
    }
    if (timeHaha2 - timePrev > 200)
    {
      throttle = 0;
      steering = 0;
      timePrev = timeHaha2 ;
      haha2Start = 0;
      hahaStart = 1;
    }
  }
}

piruet - just rotation at max possible speed
Code:
void Piruet()
{
  unsigned long timePiruet = millis();
  if (timePiruet - timePrev > 50)
  {
    if (!piruetEnding)
    {
      steering = piruetSteering;
      timePrev = timePiruet;
      piruetSteering += 15;
      if (piruetSteering > MAX_PIRUET_STEERING) piruetEnding = 1;
    }
    else
    {
      steering = piruetSteering;
      timePrev = timePiruet;
      piruetSteering -= 15;
      if (piruetSteering < 0)

      {
        steering = 0.0;
        piruetSteering = 0.0;
        piruetStart = 0;
        piruetEnding = 0;
        actionStart = 0;
      }
    }
  }
}

dance = 1 - 2 - cha-cha-cha
Code:
int8_t chacha1[] = { -1, 0, 0, 0, 1, 0, 0, 0, -1, 0, 1, 0, -1, 0, 0, 0};
int8_t chacha2[] = {  1, 0, 0, 0, -1, 0, 0, 0, 1, 0, -1, 0, 1, 0, 0, 0};
void Dance()
{
  unsigned long timeDance = millis();
  if (timeDance - timePrev > stepLenght)
  {
    steering = DANCE_STEERING * chacha1[cnt];
    timePrev = timeDance;
    cnt++;
  }
  if (cnt > 15)
  {
    cnt = 0;
    danceStart = 0;
    steering = 0.0;
    finalStart = 1;
  }
}


Turn - just turn without steering fadder
REV - change front and back , motor = -motor
Stop - set all to zero or neutral and reset fadders on OSC (if not used AutiReset function from OSC TouchMessages (/z)))
On/Off - wake-up and rise-up robot
Toggle buttons 1, 2 and 3 (at top) for speak, lights utc. I often use them for testing different codes/modes/setiings ...
You can see them all at video Smile




Find all posts by this user
Quote this message in a reply
10-13-2015, 06:58 PM (This post was last modified: 10-13-2015 08:00 PM by sasa999.)
Post: #26
RE: My implementations
(10-13-2015 01:16 PM)KomX Wrote:  As I know, sasa999 proposed changes to the code to allow the robot to balance the additional weight, but only in stop mode.
NO! It can drive too! Smile It use saved error angle. Only limitation - not allowed add or remove weight when robot drive forward or backward.

..
[Image: Screenshot_2015_10_13_21_48_53.png]
there is my OSC layout
Third page not completed yet - it will be for robot speaking
!! change *.touchosc.txt to *.touchosc


Attached File(s)
.txt  D-Robot_inv5.5_zero.touchosc.txt (Size: 2.35 KB / Downloads: 169)
Find all posts by this user
Quote this message in a reply
10-13-2015, 07:06 PM (This post was last modified: 10-13-2015 07:07 PM by KomX.)
Post: #27
RE: My implementations
(10-13-2015 06:58 PM)sasa999 Wrote:  
(10-13-2015 01:16 PM)KomX Wrote:  As I know, sasa999 proposed changes to the code to allow the robot to balance the additional weight, but only in stop mode.
NO! It can drive too! Smile It use saved error angle. Only limitation - not allowed add or remove weight when robot drive forward or backward.

mille pardon!
Find all posts by this user
Quote this message in a reply
10-13-2015, 07:26 PM
Post: #28
RE: My implementations
Hello Sasa 999,
The file does not work it will be damaged something.
Can you put it in a zip or rar archive?
Thank you
greetings VL
Find all posts by this user
Quote this message in a reply
10-13-2015, 08:05 PM (This post was last modified: 10-13-2015 08:24 PM by sasa999.)
Post: #29
RE: My implementations
(10-13-2015 07:26 PM)vlelectronic Wrote:  Hello Sasa 999,
The file does not work it will be damaged something.
Can you put it in a zip or rar archive?
Thank you
greetings VL
reloaded and checked. Don't open as text file!
right click - save - remove file extension (last 3 letters and point)
must be D-Robot_inv5.5_zero.touchosc
.
p.s. it will NOT work with original B-robot sketch because fader1 and fader2 values are changed..sorry!
if you like this layout, you must change fadders value range to 0-1 and not use TouchMessages (/z) before you not changed JJROBOTS_OSC code for them.
p.p.s. AutoReset and RST functions (page 2) will not work with original B-robot code, because this is function of ESP8266 replay. Not supported in ESP8266 AT command mode. But you can write some code and send reset messages from Leonardo or MicroPro like battery info.
Find all posts by this user
Quote this message in a reply
10-14-2015, 07:18 PM
Post: #30
RE: My implementations
Hello Sasa 999,
You can attach your ini file with its libraries?
Thank you
greetings VL
Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)