Recent Posts

Pages: [1] 2 3 ... 10
1
Software / Re: Ma readbytes() non è blocc...
Last post by ExperimentUno - Today at 02:39 am
Ho guardato nel codice della libreria, che è discretamente commentato.
Quello che mi ha sorpreso è che i calcoli per impostare i bytes della CPU li fanno fare al micro, anziché al preprocessore. Chissà come si può compilare in un ATtiny :) :)?
Credo proprio che se la voglio il codice sia bloccante dovrò metterci qualcosa di mio, come
Code: [Select]
while (Serial.peek() >0) {};
// do the rest;
2
Project Guidance / Composite Video Zoom/Pan
Last post by SnowsongWolf - Today at 02:37 am
Setup for the project:

I'm making helmet that uses a head mounted display and a wide angle color security camera.  The issue is that while the camera has a 170 degree viewing angle, the effective angle of the HMD is about 45 degrees (trying to keep costs low, I had the HMD laying around for several years).

With modifying the lenses I think I can approach 90 degrees but I still expect a headache looking at fisheye video through that.

What I would like to do is use an Arduino to do a simple zoom/pan of the incoming signal (I intend to use a fixed zoom and use head position sensors to determine pan).  I don't really understand how composite video signals work and the video playground board I found will do an overlay and still grabbing but not video editing like this.  I'm hoping given the limited scope of the edits I want to make an Arduino of some flavor might work for this, but I honestly have no idea where to start with it.

Any suggestions?
3
Project Guidance / Re: autonomous car
Last post by CrossRoads - Today at 02:34 am
cbhunter,
Please click More... and Edit your post to put some punctuation in. It's difficult to read one big long run-on sentence.
4
Programming Questions / Re: Fading Three LED
Last post by lloyddean - Today at 02:30 am
Could write your code to be a bit more adaptive -

Code: [Select]

#define ANALOG_BITS_OF_RESOLUTION       (8)
#define ANALOG_RANGE                    (1 << ANALOG_BITS_OF_RESOLUTION)
#define ANALOG_MIN                      (0)
#define ANALOG_MAX                      (ANALOG_RANGE - 1)

#define BRIGHTNESS_MAX                  (ANALOG_MAX - 4)

int RED_LED = 12;       // the PWM pin the LED is attached to
int BLUE_LED = 14;
int GREEN_LED = 15;

int RedLedBrightness = 0;   // how bright the LED is
int GreenLedBrightness = 0;     // how bright the LED is
int BlueLedBrightness = 0;      // how bright the LED is
int CyanBrightness = 0;
int YellowBrightness = 0;

int ClearBrightness = 0;


int RedFadeAmount = 5;
int GreenFadeAmount = 5;
int BlueFadeAmount = 5;
int CyanFadeAmount = 5;

byte RedGradualChangeBit, GreenGradualChangeBit, BlueGradualChangeBit, CyanGradualChangeBit;

unsigned long previousMillis = 0;
const long interval = 10;

unsigned long previousMillis1 = 0;
const long interval1 = 100;

unsigned long previousMillis2 = 0;
const long interval2 = 4000;

int i = 0;
char Store[10];
int j = 0;


char incomingByte;  // for incoming serial data
String inputString = "";        // a string to hold incoming data
boolean stringComplete = false;     // whether the string is complete

void setup()
{
    pinMode(RED_LED,   OUTPUT);
    pinMode(BLUE_LED,  OUTPUT);
    pinMode(GREEN_LED, OUTPUT);

    Serial.begin(115200)
}

void loop()
{
    if ( (millis() - previousMillis2) >= interval2 )
    {
        previousMillis2 = millis();

        j += 1;
        if ( j > 5 )
        {
            j = 1;
        }

        Serial.print("\n");
        Serial.println(j);
    }

    SpecialFunction(j);
}




void SpecialFunction(int Number)
{
    if ( millis() - previousMillis >= interval )
    {
        previousMillis = millis();

        if ( Number == 1 )
        {
            RedGradualChange();
        }
        else if ( Number == 2 )
        {
            GreenGradualChange();
        }
        else if ( Number == 3 )
        {
            BlueGradualChange();
        }
        else if ( Number == 4 )
        {
            YellowGradualChange();
        }
        else if ( Number == 5 )
        {
            CyanGradualChange();
        }
    }
}

void RedGradualChange(void)
{
    BlueGradualChangeBit = 0;
    CyanGradualChangeBit = 0;
    YellowGradualChangeBit = 0;
    GreenGradualChangeBit = 0;
    RedGradualChangeBit = 1;
    ClearAllOther();

    analogWrite(RED_LED, RedLedBrightness);
    RedLedBrightness = RedLedBrightness + RedFadeAmount;

    if ( (RedLedBrightness <= 0) || (RedLedBrightness >= BRIGHTNESS_MAX) )
    {
        RedFadeAmount = -RedFadeAmount;
    }
}

void GreenGradualChange(void)
{
    BlueGradualChangeBit = 0;
    CyanGradualChangeBit = 0;
    YellowGradualChangeBit = 0;
    RedGradualChangeBit = 0;
    GreenGradualChangeBit = 1;
    ClearAllOther();


    analogWrite(GREEN_LED, GreenLedBrightness);
    GreenLedBrightness = GreenLedBrightness + GreenFadeAmount;
    if ((GreenLedBrightness <= 0) || (GreenLedBrightness >= BRIGHTNESS_MAX))
    {
        GreenFadeAmount = -GreenFadeAmount;
    }
}


void BlueGradualChange(void)
{

    BlueGradualChangeBit = 1;
    CyanGradualChangeBit = 0;
    YellowGradualChangeBit = 0;
    RedGradualChangeBit = 0;
    GreenGradualChangeBit = 0;
    ClearAllOther();


    analogWrite(BLUE_LED, BlueLedBrightness);
    BlueLedBrightness = BlueLedBrightness + BlueFadeAmount;

    if ((BlueLedBrightness <= 0) || (BlueLedBrightness >= BRIGHTNESS_MAX))
    {
        BlueFadeAmount = -BlueFadeAmount;
    }
}

void CyanGradualChange(void)
{
    BlueGradualChangeBit = 0;
    CyanGradualChangeBit = 1;
    YellowGradualChangeBit = 0;
    RedGradualChangeBit = 0;
    GreenGradualChangeBit = 0;
    ClearAllOther();

    analogWrite(BLUE_LED,  CyanBrightness);
    analogWrite(GREEN_LED, CyanBrightness);
    CyanBrightness = CyanBrightness + CyanFadeAmount;


    if ((CyanBrightness <= 0) || (CyanBrightness >= BRIGHTNESS_MAX))
    {
        CyanFadeAmount = -CyanFadeAmount;
    }
}


void YellowGradualChange(void)
{
    BlueGradualChangeBit = 0;
    CyanGradualChangeBit = 0;
    YellowGradualChangeBit = 1;
    RedGradualChangeBit = 0;
    GreenGradualChangeBit = 0;
    ClearAllOther();

    analogWrite(RED_LED,   YellowBrightness);
    analogWrite(GREEN_LED, YellowBrightness);
    YellowBrightness = YellowBrightness + YellowFadeAmount;


    if ((YellowBrightness <= 0) || (YellowBrightness >= BRIGHTNESS_MAX))
    {
        YellowFadeAmount = -YellowFadeAmount;
    }
}

void ClearAllOther(void)
{
    if ( RedGradualChangeBit )
    {
        analogWrite(BLUE_LED,  ClearBrightness);
        analogWrite(GREEN_LED, ClearBrightness);

        GreenLedBrightness = 0; // how bright the LED is
        BlueLedBrightness = 0;  // how bright the LED is
        CyanBrightness = 0;
        YellowBrightness = 0;

        GreenFadeAmount = 5;
        BlueFadeAmount = 5;
        CyanFadeAmount = 5;
        YellowFadeAmount = 5;

    }

    if ( GreenGradualChangeBit )
    {
        analogWrite(BLUE_LED, ClearBrightness);
        analogWrite(RED_LED,  ClearBrightness);

        RedLedBrightness = 0;
        BlueLedBrightness = 0;
        CyanBrightness = 0;
        YellowBrightness = 0;


        RedFadeAmount = 5;
        BlueFadeAmount = 5;
        CyanFadeAmount = 5;
        YellowFadeAmount = 5;

    }

    if ( BlueGradualChangeBit )
    {
        analogWrite(RED_LED,   ClearBrightness);
        analogWrite(GREEN_LED, ClearBrightness);

        RedLedBrightness = 0;
        GreenLedBrightness = 0;
        CyanBrightness = 0;
        YellowBrightness = 0;

        RedFadeAmount = 5;
        GreenFadeAmount = 5;
        CyanFadeAmount = 5;
        YellowFadeAmount = 5;

    }

    if ( CyanGradualChangeBit )
    {
        analogWrite(RED_LED, ClearBrightness);

        RedLedBrightness = 0;
        GreenLedBrightness = 0;
        BlueLedBrightness = 0;
        YellowBrightness = 0;


        RedFadeAmount = 5;
        GreenFadeAmount = 5;
        BlueFadeAmount = 5;
        YellowFadeAmount = 5;

    }

    if ( YellowGradualChangeBit )
    {
        analogWrite(BLUE_LED, ClearBrightness);

        RedLedBrightness = 0;
        GreenLedBrightness = 0;
        BlueLedBrightness = 0;
        CyanBrightness = 0;

        RedFadeAmount = 5;
        GreenFadeAmount = 5;
        BlueFadeAmount = 5;
        CyanFadeAmount = 5;
    }
}
5
I have relay board that is controlled by shift register:
http://www.crossroadsfencing.com/BobuinoRev17/

Here's some video several daisy chained to control 120V LED light strings:
https://www.youtube.com/watch?v=ukRtgLK_b5c
https://www.youtube.com/watch?v=oHTRGXyd3xU
6
Programming Questions / Re: terminate Loop()
Last post by saximus - Today at 02:27 am
The general consensus seems to be not to terminate it since there is nothing to really exit to once you're done. You could possibly use while(1); which could have the same desired effect.

Do you have a plan for how you will you retrieve the data that was collected? Are you sending the data over a serial connection or do you have something at startup that lets you retrieve the collected data before it starts collecting new data?
7
I found the solution after so long, I read this blog: http://www.arduino.utfsm.cl/0-2-errores-comunes/ and it said I have to disconnect the modem port wifi.

This is someone happens to him in the future.
8
Project Guidance / Re: Aquarium Computer
Last post by groundfungus - Today at 02:17 am
Google Arduino aquarium.  Here is one hit open aquarium  This is a subject that regularly comes up on this forum so a search here might yield more information, too.
9
Programming Questions / Re: terminate Loop()
Last post by Jiggy-Ninja - Today at 02:16 am
while(1); or for( ;; ); will stop your controller dead in it's tracks, but that's probably not what you want.

This smells of an X-Y problem. How about giving us some more info on what you're doing?
10
Programming Questions / Re: Examples "Robot Control" ...
Last post by pert - Today at 02:13 am
You need to do this:
  • Tools > Board > Boards Manager
  • Wait for downloads to complete.
  • Click on Arduino AVR Boards
  • Select 1.6.10 from the "Select version" dropdown menu.
  • Click the "Install" button.
  • Wait for installation to complete
  • Click the "Close" button.


The problem is the Arduino Robot libraries have been retired and changes since Arduino AVR Boards 1.6.10 have broken those libraries. I'll report this to the Arduino developers but I'm guessing the solution will be to remove those libraries rather than spending time to fix them.
Pages: [1] 2 3 ... 10

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy