Recent Posts

Pages: [1] 2 3 ... 10
1
My guess is that the SD is not connected solidly or is overheating due to someone shortcutting the 5V to 3.3V leveling.
2
3
Storage / Really Bizarre SD Card Board P...
Last post by gdogabbott - Today at 05:21 am
I have an Adafruit Micro SD Breakout Board attached to an Arduino MEGA2560. Running CardInfo I couldn't get the card to initialize. I triple checked the wiring, tried a few different cards, nothing. Eventually through jiggling all the wires and poking at it in hopes I could find the issue I discovered that if I pressed my thumb against the back of the card slot (as shown in included picture) it would initialize the card perfectly. After I take my thumb off it will continue to recognize the card each time I hit the reset button, as long as I hit it every few seconds. If I wait longer than ~10 seconds it won't recognize it anymore.

I'm assuming that this is some sort of card contact issue, but I have no idea what I'm doing to cause it to succeed.

4
Keep a variable in which mode you are (security or coop). It can be global (usually declared before setup()) or static in the function.

Code: [Select]
void loop()
{
  // mode; 0 is coop, 1 = security
  static byte mode = 0;

  char myKey = myKeypad.getKey();
  Serial.print("Pressed: ");
  Serial.println(myKey);

  if(key == '#')
  {
    mode = 1;
  }

  ...
  ...
}

How you get out of security mode is another question.

Now it might be a bit difficult to remember what 0 and 1 mean. Therefor you can use an enum or a #define which allows you to use sensible names; the below uses the latter.

Code: [Select]
// modes that application can be in
#define MODE_COOP 0
#define MODE_SECURITY 1

...
...
void setup()
{
  ...
  ...
}

void loop()
{
  // mode
  static byte mode = MODE_COPE;

  char myKey = myKeypad.getKey();
  Serial.print("Pressed: ");
  Serial.println(myKey);

  if(key == '#')
  {
    mode = MODE_SECURITY;
  }

  ...
  ...
}


And just for your information, the below can be a lot shorter.
Code: [Select]
    if (myKey == '0' || myKey == '1' || myKey == '2' || myKey == '3' ||
        myKey == '4' || myKey == '5' || myKey == '6' || myKey == '7' ||
        myKey == '8' || myKey == '9' ) {

If you look at e.g. this ascii table, you will see that the digits 0..9 are consecutive (0x30..0x39). So instead of testing for every single value, you can check if the character is in range.
Code: [Select]
    if (myKey >= '0' && myKey <= '9')
5
Looks like a problem of geometry rather than programming. Lizards have 4 legs approximately the same length, but your frog is a very different shape.
Have you analyzed the gait to see what the motion should be?
6
Project Guidance / Re: TFT Screen on Arduino Uno ...
Last post by Wawa - Today at 05:13 am
The only real info we have now is that you're using an Uno.

No links to the TFT screen, SD card, no diagram or how you power the setup, no code, etc.
Should we guess ?

I guess power.
You're powering the setup externally, with a 12volt power supply (too high), and the 5volt regulator overheats and shuts down. But I could be wong.

Read the "how to post" sticky that's on top of every main page.
Leo..
7
Hello

I'm sending Image byte data to server.

String payload is like
value=255,216,255,224,0,16,74,70,73,70,0,1,1,1,0,0,0,0,0,0,255,219,0,67,0,12,8,9,11,9,8,12,11,10,11,14,13,12,14,18,30,20,18,17,17,18,37,26,2


         
        HTTPClient httpClient;
         httpClient.begin(targetUrl);
         httpClient.addHeader("Content-Type","application/x-www-form-urlencoded");
         int httpCode = httpClient.POST(payload);
        Serial.println("httpcode");
         Serial.println(httpCode);
        httpClient.end();

but httpCode is always -1
and I checked server's logs. It didn't reach.

below is node js server that image should arrive.

      app.post('/pic',function(request,response){

       }
8
Our professor gave us a sample code, its a gait for a lizard.
I've ran it with the frog system and it crawls but it is obvious that it is set up for a different style of motion.

Of course the other three groups in the class are doing lizards, so my group has got to improvise.

I've revised all of the servo names and variables to fit our frog, but have yet to be able to manipulate the code to get it where I want it.

Its using a delay(), which is fine for the lizard gait, but not good for our frog.


Code: [Select]


//MAE-495, Bio-Inspired Robotics
//Group 1 (BLUE-FROG), David, Jacob, Jonathan, Nathan, Peter, Tim.
//This code serves to mimic the gait of a frog while it is crawling.
//------------------------------------------------------------------

#include<Servo.h>

Servo Rightshoulder,Rightarm,Leftshoulder,Leftarm;
Servo Righthip,Rightleg,Lefthip,Leftleg;

int Time = 20;

int Rs=90, Rh=90, Ls=90, Lh=90;
int Ra=90, La=90, Rl=90, Ll=90;

boolean step1=false, step2=false, step3=false, step4=false;

int a=0, b=0, c=0, d=0, e=0;

void setup()
{
  Serial.begin(9600);
 
  pinMode(13,OUTPUT);
 
  //links pins to servos
  Rightarm.attach(2);
  Rightshoulder.attach(3);
  Leftarm.attach(4);
  Leftshoulder.attach(5);
  Rightleg.attach(6);
  Righthip.attach(7);
  Leftleg.attach(8);
  Lefthip.attach(9);


  //set‐up first frame of gait
  Rightarm.write(Ra);
  Leftarm.write(La);
  Rightleg.write(Rl);
  Leftleg.write(Ll);
  Rightshoulder.write(Rs);
  Leftshoulder.write(Ls);
  Righthip.write(Rh);
  Lefthip.write(Lh);

  step1=true;
}


void loop()
{
  digitalWrite(13,HIGH);

  //Frame 1:Left Leg Steps
  while(step1==true)
  {
    Rs=Rs+1;
    Rh=Rh+1;
    Ls=Ls-1;
    Lh=Lh+3;
    a++;
   
    if(e<15)
    {
      Ll=Ll+4;
      e++;
    }
   
    else
    {
      Ll=Ll-4;
      e++;
    }
   
    Rightshoulder.write(Rs);
    Leftshoulder.write(Ls);
    Righthip.write(Rh);
    Lefthip.write(Lh);
    Leftleg.write(Ll);
   
    delay(Time);

    if(a<30)
    {
      step1=true;
    }

    else
    {
      step1=false;
      step2=true;
      a=0;
      e=0;
    }
  }

  //Frame2:Left Arm Steps
  while
  (step2==true)   
  {
    Rs=Rs+1;
    Rh=Rh+1;
    Ls=Ls+3;
    Lh=Lh-1;
    b++;
   
    if(e<15)   
    {
      La=La+4;
      e++;
    }
   
    else
    {
      La=La-4;
      e++;
    }
   
    Rightshoulder.write(Rs);
    Leftshoulder.write(Ls);
    Righthip.write(Rh);
    Lefthip.write(Lh);
    Leftarm.write(La);
    delay(Time);
   
    if(b<30)   
    {
      step2=true;
    }

    else
    {
      step2=false;
      step3=true;
      b=0;
      e=0;
    }
}

  //Frame3:Right Leg Steps

  while(step3==true)
  {
    Rs=Rs+1;
    Rh=Rh-3;
    Ls=Ls-1;
    Lh=Lh-1;
    c++;
     
    if(e<15)
    {
      Rl=Rl-4;
      e++;
    }
   
    else
    {
      Rl=Rl+4;
      e++;
    }

    Rightshoulder.write(Rs);
    Leftshoulder.write(Ls);
    Righthip.write(Rh);
    Lefthip.write(Lh);
    Rightleg.write(Rl);
    delay(Time);
   
    if(c<30)
    {
      step3=true;
    }
   
    else
    {
      step3=false;
      step4=true;
      c=0;
      e=0;
    }
}

//Frame 4: Right Arm Steps
while(step4==true)
{
  Rs=Rs-3;
  Rh=Rh+1;
  Ls=Ls-1;
  Lh=Lh-1;
  d++;

  if(e<15)   
  {
    Ra=Ra-5;
    e++;
  }

  else
  {
    Ra=Ra+5;
    e++;
  }
 
  Rightshoulder.write(Rs);
  Leftshoulder.write(Ls);
  Righthip.write(Rh);
  Lefthip.write(Lh);
  Rightarm.write(Ra);
  delay(Time);

  if(d<30)
  {
    step4=true;
  }

  else
  {
    step4=false;
    step1=true;
    d=0;
    e=0;
  }
  }
}





Here's a video of it with the lizard gait running...

https://www.youtube.com/watch?v=OXFFrKtSzCU&feature=youtu.be
9
The ground path for your divider (as shown) is through the mosfet. With the mosfet OFF, you have no ground, and all points of the circuit will reach max potential--12VDC. Try and see. It's the easiest way to learn.
I have tried it, the largest voltage measured under any circumstances @ middle of divider is 5.2V....if it got 12V I would have fried the pin.

I am trying to gather parts for allan's circuit now, not sure I have all the comps....

and thanks allan for the description of the circuit, that's helpful.
10
Storage / How to use EEPROM to save my s...
Last post by UdDReX - Today at 05:09 am
I was trying to make an automated water pump control system using ultrasonic sensor and use Bluetooth for serial monitoring and to change settings(where I never used EEPROM before). But as I wrote the code, everything works except the settings part. I comment out the part which I had the problem. Also, any sort of extra help in optimizing the code is welcomed.

Plz, help me with this code running asap.
Pages: [1] 2 3 ... 10