Show Posts
Pages: [1] 2 3 ... 9
1  Products / Arduino Yún / Re: Arduino YUN can't work on: July 02, 2014, 04:31:00 pm
Ironically someone came to me with the same problem today. Ultimately, I found your answer!

Look at the example code that you are using. It requires you to open the serial monitor and type in a speed value.

Also, at the lower amperage the Yun will supply, you will need to hand start the motor to overcome inertial resistance. A more powerful power supply would eliminate this step. If you are hearing the motor, this is likely the issue you are having.

And leave the diode in, i'm sure its there for a reason. Kickback I think.
2  Products / Arduino Yún / Re: Arduino YUN can't work on: July 02, 2014, 07:50:28 am
Like to disclaim that I'm no expert, so others can correct me if I'm wrong about this.

In that circuit... Yes, I guess it is protecting the pin, but still drawing power from the Arduino power supply. It might be helpfull to note that the UNO might draw 20-30mAh when idle with little else attached and the Yun I have noticed might draw about 200-300mAh in the same situation.

This is a significant 10X difference, particularly when at 500mAh the polyfuse will be tripped on the YUN. The doc you attached says the motor could draw about 200mAh, this is cutting it close to tripping. To reset a tripped poly, you need to unplug for a minute to let it reset. After doing this check if you can wifi upload the the bridge sketch, see if you can blink the LED. Then try the motor again and pay attention to whether the motor is causing the problem. The other question that comes up is, what is your power supply rated for? Some cell phone chargers deliver less then 500mAh.  This is just a strong nagging suspicion on my part, could be something else.
3  Products / Arduino Yún / Re: Arduino YUN can't work on: July 01, 2014, 03:04:27 pm
Think your drawing too much current and browning out?

What the circuit look like?
4  Using Arduino / Project Guidance / Re: Capacitive feedback on: June 24, 2014, 09:33:25 pm
All interesting input, thank you.

Hate to sound picky considering we are talking about potential magic, but I was told that this magic was painless.

Would a low current 50voltish alternating current possibly produce a painless sensation?

Think I need a guinea pig  smiley
5  Using Arduino / Project Guidance / Re: Capacitive feedback on: June 24, 2014, 03:53:38 pm
You know after searching for this I want to say that he was yanking my chain.  smiley

Typically I have pretty good sense for that type of joke though and the conversation was pretty serious. The idea was based on work with.. well a company making devices that need to be absolutely silent when pulling the trigger, but the trigger puller still need to feel the sensation for legal reasons. Everything else was over my head at the time. Ok.. this was probably more then a few months ago at this point. There was something said about the effect occurring with poorly grounded ac to dc inverters.

Really should have followed up with him. Failed realized if this was a joke or really something special.
6  Using Arduino / Project Guidance / Capacitive feedback on: June 24, 2014, 01:47:46 pm
Google failed to help me with this one. Probably because this might be called something else.

A few months a I was at local gathering and someone who seemed to really know what he was talking about, explained to me that capacitance could work two ways. One way to sense obviously and another provide feedback through a very subtle shock or something.  One of the guys demonstrated the effect with his macbook air plugged in and touch a specific spot on the uni-body.

Said it was used for silent triggers and things of the like.

I'm interested in using this type of feedback in place of pager motors for my project. Anybody know of any resources to get started?
7  Using Arduino / Programming Questions / Re: Pattern based if statements? on: June 17, 2014, 07:20:45 pm
Yeah.. what Delta_G said.

C++ has all these funny sort of short-cuts that I'm finding all over the place. I probably should avoid them in the interest of making the code more readable. The problem is more lines of code equals more to read which also works against readability.  If I was working on a smaller problem would probably stick with keeping the assignment and the condition testing separate.
8  Using Arduino / Programming Questions / Re: Pattern based if statements? on: June 17, 2014, 04:15:09 pm
Code:
void setup()
{
  Serial.begin(9600);
  spacerTimer(1);
}

void loop()
{
  if(byte progress = spacerTimer(0))
  {
    if(progress % 5 == 0)
    {
      Serial.println(progress);
    }
  }
}

byte spacerTimer(byte reset)
{
#define DELAYTIME 1 //the delay time corresponds to action values
#define TIMESTARTED 0 // Denotes when each action starts
#define SPACER 100 // ms
  static uint32_t timer[2] = {};// holds time started and delay time
  static byte progress=0; //keeps the progress of the actions

  if(reset)
  {
    progress=0;//set everything back to the begining
    timer[DELAYTIME]=SPACER; //set the intial timing
    timer[TIMESTARTED]=millis();  // note the start time of the transition
  }
  else if(millis() - timer[TIMESTARTED] > timer[DELAYTIME])
  {
    progress++;//increment the progress of the time table
    timer[DELAYTIME]=SPACER; //set duration based on progress level
    timer[TIMESTARTED]=millis();  // note the start time of the transition
    return progress; //return which level of progress has elapsed
  }
  return 0;// in most cases this function is called, time will yet to be elapsed
}

Yeah this was pretty simple, sorry
9  Using Arduino / Programming Questions / Re: Pattern based if statements? on: June 17, 2014, 04:08:47 pm
Thought about modulo right after I posted and face palmed...

Anyhow I'll post when I have something working, so this wasn't a complete waste of space
10  Using Arduino / Programming Questions / Pattern based if statements? on: June 17, 2014, 03:50:41 pm
Curious if there is a simple way to do this

Code:
byte comparison = 5;
byte count = 1;
while(1)
{
   if ( count == *divisible by* comparison)
   {
      //do the thing
   }
   count++;
}

Have a timer that reports an incremented byte "about" every 10ms. However one of the instructions would be better executed every 50ms.
11  Using Arduino / Project Guidance / Re: Demonstration code for several things at the same time on: June 13, 2014, 01:15:18 pm
First of all, I commend Robbin's effort of showing newbies how to manage time.

Going to point out something a little less technical  though. Sometimes people need to step in poo before really understanding it smells. Even after countless people have told them how much it smells. In the figurative sense my feet have a lot of lingering smell, probably the worst offender of this.

Tried to show a bunch of kids how to set robot motors without delays. Even basically built the functions for them. Long story short, gave up and told them to use delays. After that, they started making progress as opposed to being confused. The quality of my explanation mattered very little.

A smart person knows when they are right. A wise person knows when being right matters.
12  Using Arduino / Programming Questions / Re: Where to add delay?? on: June 13, 2014, 12:13:17 pm
Code:
const int pirPin = 2;     
const int relayPin =  13;     

void setup()

  pinMode(relayPin, OUTPUT);     
  pinMode(pirPin, INPUT);     
}

void loop()

  if (digitalRead(pirPin))//guesing pir being HIGH means your pir was tripped? please comment
  { // if(the pirPin is HIGH) aka "true" or "1" or anything besides zero   
    digitalWrite(relayPin, LOW);//turn your light off or on? assuming on given detection
    delay(110200); // delay after detection, presumably so someone can see where they are going or something
    digitalWrite(relayPin, HIGH);// turn light off ??
    delay(15000);// delay afterwards preventing anything else happening
  }
}

Delay will become the bane of your existence if you are into this for any amount of time, so I agree with the statement above. Figure out how to get rid of them ASAP as practice, its worth it.
13  Using Arduino / Programming Questions / Re: Excluding a bit in a comparison on: June 13, 2014, 11:50:03 am
Code:
void setup()
{
  Serial.begin(9600);

  for(int i=0;i<255;i++)//for all of the byte address space
  {
    if(byte writeable = uniTranslator(i))
    {
      Serial.print(i);
      Serial.print(" - ");
      if(writeable== 8 || writeable == 32)
      {//special cases with unclear serial results
        Serial.print(writeable);
        Serial.print("-raw");
      }
      else
      {
        Serial.write(writeable);
      }
      Serial.println();
    }
  }

}

void loop()
{
}

byte uniTranslator(byte base)
{
  static byte chordPatterns[] {1,5,48,56,2,24,33,6,4,14,28,12,40,30,7,18,31,3,16,32,51,45,8,35,54,49,};
  #define PATTERNSIZE sizeof(chordPatterns)
 
  if(base == 128){return 8;}//Express conversion: Backspace // Backspace doubles as second level shift for special chars
  if(base == 64){return 32;}//Express conversion: Space // Space also doubles as the first shift in a chord
 
  for (byte i=0; i<PATTERNSIZE; i++)   
  {// for all of the key mapping   
    if ( (base & 63) == chordPatterns[i] )
    {//pattern match regardless most significant 2 bits // 63 = 0011-1111 // mask the 6th and 7th bit out
      if ((base & 192) == 192){break;} //third level shift *combination holding space and backspace
      if (base & 64)//first level shift *combination with space
      {// 64 = 0100-0000 // if( 6th bit is flipped high )
        //if(lower shift, less than 10th result) {return corresponding number}
        if(i<10){return '0' + i;} //a-j cases (ascii numbers)
        if(i<25){return 23 + i;}  //k-y cases ( !"#$%&'()*+'-./ )
        if(i==26){break;}         //z case (unassigned)
      }
      if (base & 128)//second level shift *combination with backspace
      {//128 = 1000-0000 // if(7th bit is high)
        if(i<7){return ':' + i;}//a-g cases ( :;<=>?@ )
        if(i<13){return 84 + i;}//h-m cases ( [\]^_`  )
        if(i<17){return 110 + i;}//n-q cases( {|}~    )
        break;                   //other cases unassigned
      }
      return 'a' + i;// return plain char based on position in the array given no shift
    }
  }
  return 0;
}

This does basically everything, though its made mostly convenient to the efficiency of the function as opposed to a layout of shift pattern that might be actually efficient to a user.

Sorry, ignored the speed change just for a test, but I'll keep that in mind in the future.

Keep in mind that the output of this function is pushed through a debouncing/hold detection function afterwards. Holds produces the typical "shift" case most are use to replacing the lower with an upper case. Which is why that type of shift is ignored here. The raw button data is being pushed through this function.. which now when I think about it is is probably really inefficient... but I guess I'm going to find out if it even matters as I use the keyer.

Using this function in the main body of code is going to be another adventure. A function doing the same thing in inverse is also needed to drive the 6 hapic feedback pagers with 8 signals.... Think I'll just make shift animations when 6th and 7th bits to go through the haptic messaging function...



14  Using Arduino / Programming Questions / Re: Excluding a bit in a comparison on: June 12, 2014, 04:03:22 pm
Good catch, it compiled because I was consistent about my mistake, haha

Thanks again,

now I going to build it for all the ascii characters. Now that I see this approach I think I'll find the simplest way to do this going all or nothing.
15  Using Arduino / Programming Questions / Re: Excluding a bit in a comparison on: June 12, 2014, 01:50:42 pm
@robtillaart Great simplification! I understand now, this really made my day.

Should have realized a comparison was unnecessary with "letter & mask"
If something can be seen through the mask its true!

Originally went 2d on the array  because special characters follow a less convenient pattern
In the case of just alpha characters though the following achieves exactly what I was looking for
Code:
#define ENCODEAMT 26 // size is defined to structure iteration amount
byte byteToBraille [2][ENCODEAMT] // Braille conversion array
{
    1 , 5 , 3 , 11, 9 , 7 , 15, 13, 6 , 14, 17, 21, 19, 27, 25, 23, 31, 29, 22,  30, 49, 53, 46, 51, 59, 57,  
};//each bit in the corresponding bytes represents a "bump" state


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

  for(byte i=0;i<255;i++)
  {
    Serial.print(i);
    Serial.print(" - ");
    Serial.write(brailleConvert(i));
    Serial.println();
  }

}

void loop()
{
}

byte brailleConvert(byte brailleIn)
{
  byte maskedValue = brailleIn & 127;
                                                                               // 127 = 0111-1111 // mask the 7th bit out  
  for (byte i=0; i<ENCODEAMT; i++)  
  {                                                                            // for all of the key mapping
    if ( maskedValue == byteToBraille[1][i] )
    {                                                         // given a match absent of the 7th bit (there will be two sets of ENCODEAMT values)
      if (brailleIn & 128)
      {                                                                      // 128 = 1000-0000 // if( 7th bit is fliped high )
        if(maskedValue < 17){return '0' + i;}
                                                   // absent of the 7th bit, if(lower shift, less than 17 or 'k' equivalent) {return corresponding number}
        break;                                                          // else return 0! avoid irrelivent shifts (filtering out 16 results)
      }
      return 'a' + i;                                                 // return char
    }
  }
  return 0;
}


Thank you!
Pages: [1] 2 3 ... 9