Recent Posts

Pages: [1] 2 3 ... 10
1
Français / Re: Programmateur d'arrosage a...
Last post by sancho119 - Today at 07:33 am
Je désespère
Je passe des soirées à essayer de résoudre mon problème, rien n'y fait...
Je trouve beaucoup d'exemples sur le net avec une page web hébergée sur l'arduino, mais très peu avec une page hébergée ailleurs...hormis celui d'eskimon
2
@Allanhurst

The project consists in:

a) Photovoltaic charger - see separate thread - completed
b) Wind turbine charger -  this thread - ongoing
c) Lighting system - simplified version so far - no thread foreseen
d) Control system - under preparation by providing control points in each of the components above (a, b,c). - no thread by now.

The d) - control system - is where the Arduinos come in.

Step by step :-))

+++

[OT maybe: I love to understand what I am doing, even in the simpliest cases. See the Joule thief circuit- everywhere is given as a "simple thing to make". Yes, but is not as simple to understand. I hate "monkey see monkey do" :-)))]


3
Arduino Due / Re: Arduino Due programmer alt...
Last post by rafeeq - Today at 07:30 am
you can read here,
http://www.elecrom.com/program-arduino-due-atmel-studio/

he explain program due from ATMEL Studio.
let me know if works for you, else there is one more option available
4
Storage / Re: A error opening and writin...
Last post by sterretje - Today at 07:27 am
Have you tried plant.htm ?
Baseband less than 8 characters, extension limited to 3 characters.
5
It's a SAM cortex so expect 3.3V or less operation. You will need voltage leveling to not smoke your SAM pins. There's lots of ways to do that but check out the 74HC4050 hex buffer made for 5V-3.3V work. Shop around, you can get a few for 50 cents or less (I paid 35 cents ea for 10 or so), they have 6 channels that you wire 5V to 3V on a 16 pin chip that you can wire a resistor and a diode per channel to replace instead but it ill take more board space. Be sure to get the DIP version unless you surface mount your own chips.

Example is 5V Arduino to 3.3V SD card. The Arduino OUTPUTS on SCLK, MOSI and SEL pins, those lines need leveling. The SD also needs at least 100mA capable 3.3V as 80mA surges are known. The MISO line is 3.3V OUTPUT, it can connect directly to the Arduino MISO pin and flip the bit just fine. And be sure to connect the grounds.

The resistor and diode leveling is pretty keen. You put a diode between 5V OUTPUTs and 3V INPUTs to block 5V to 3V flow and then you supply the 3V side through a 4.7K resistor. When the 5V pin is LOW, the 3V pullup gets drained through the diode and the 3V device reads LOW. When the 5V pin is HIGH, the 3V device reads the pullup HIGH. This beats power-wasting voltage dividers.

Note that a single 74HC4050 can level 2 SPI devices with 3 channels each.
6
Programming Questions / Re: Server delay
Last post by vaj4088 - Today at 07:27 am
Use millis() for timing and NOT delay(...).  There is a tutorial at the top of the forum that will help you with this. Some people find millis() hard to learn but learning to not use delay(...) is worthwhile in the long run.
7
Programming Questions / Re: Keypad .kstate question
Last post by bsohn - Today at 07:21 am
So here is what I get as an output which takes 6 loops for one encoder detent in the Clockwise Rotation.

LOOP 1
Encoder 27 28                             -- This is the correct encoder Pair as defined in // Determine Active Encoder A or B
Encoder State 1                           -- This is the correct Pressed State for button 28 (encoder output B)
A Encoder Found = -1                  -- This seems right, however,further output issues indicate otherwise
B Encoder Found = -1                  -- I would expect this to be "0" or "28" as  Button 28 is pressed
Encoder Button 28 is pressed       -- This is the correctly determined Button State for this loop

LOOP 2
Encoder 27 28                             -- This is the correct encoder Pair as defined in // Determine Active Encoder A or B
Encoder State 1                           -- This is the correct Pressed State for button 27 (encoder output A)
A Encoder Found = -1                  -- I would expect this to be "1" or "27" as  Button 27 is pressed
B Encoder Found = -1                  -- I would expect this to be "0" or "28" as  Button 28 is still pressed
Encoder Button 27 is pressed        -- This is the correctly determined Button State for this loop

LOOP 3
Encoder 27 28                             -- This is the correct encoder Pair as defined in // Determine Active Encoder A or B
Encoder State 3                           -- This is the correct Released State for button 28 (encoder output B)
A Encoder Found = -1                  -- I would expect this to be "1" or "27" as  Button 27 is still pressed
B Encoder Found = -1                  -- I would expect this to be "0" or "28" as  Button 28 is being released
Encoder Button 28 is released        -- This is the correctly determined Button State for this loop

LOOP 4
Encoder 27 28                             -- This is the correct encoder Pair as defined in // Determine Active Encoder A or B
Encoder State 0                           -- This is the correct Idle State for button 28 (encoder output B)
A Encoder Found = -1                  -- I would expect this to be "1" or "27" as  Button 27 is still pressed
B Encoder Found = -1                  -- I would expect this to be "-1" as  Button 28 is Idle
Encoder Button 28 is idle              -- This is the correctly determined Button State for this loop

LOOP 5
Encoder 27 28                             -- This is the correct encoder Pair as defined in // Determine Active Encoder A or B
Encoder State 3                           -- This is the correct Released State for button 27 (encoder output A)
A Encoder Found = -1                  -- I would expect this to be "1" or "27" as  Button 27 is being released
B Encoder Found = -1                  -- I would expect this to be "-1" as  Button 28 is Not Active
Encoder Button 27 is released        -- This is the correctly determined Button State for this loop

LOOP 6
Encoder 27 28                             -- This is the correct encoder Pair as defined in // Determine Active Encoder A or B
Encoder State 0                           -- This is the correct Idle State for button 27 (encoder output A)
A Encoder Found = -1                  -- I would expect this to be "-1" as  Button 27 is Idle
B Encoder Found = -1                  -- I would expect this to be "-1" as  Button 28 is Not Active
Encoder Button 27 is idle              -- This is the correctly determined Button State for this loop

I am probably off in what I think the findInList() outputs are for Idle but I know they should probably change from being returned as -1 (or not in list for every loop). I have done another test program which uses basically the same code but is carried in an Event handler (without the switch) where it actually does give me correct findInList() outputs so I am really quite confused..

I have tried changing the Variable type = Byte constantly outputs 255, Int constantly outputs -1, and char constantly outputs a Diamond with a ? in it.

I belive that if I can track the state of the paired buttons through the loops with the findInList() I should be able to determine the point at which to trigger a single actual HID Joystick button output. This should also allow me to not get the encoder positions in list confused if another input is detected such as a button press placing itself between the Encoder A and Encoder B in the active encoder list.

Any help would be greatly appreciated.. I have this feeling I am just missing something REALLY small such as the placement of things in the loops or a variable type or something that I should have been able to figure out but have just NOT yet.
8
I see a problem using Pin12 for RX - in serial transmission the idle condition is HIGH and that is set by the sending device, not the Arduino. I reckon the HIGH for serial-idle will interfere with SPI.

...R
What you are saying is correct, but it should not cause the problem, since as long as CS is not triggered, ISP should not interfere, and this is proven by the sketch working as I want whe the SD card module is unplugged.

What do you think?
9
What does arr_temp look like?

And sizeof(E1_OTP0[0]) returns the size of the pointer which is either 1 or 2 (I'm not sure).
10
Programming Questions / Re: Keypad .kstate question
Last post by bsohn - Today at 07:14 am
OK, Well after a Bunch more playing I feel like I am going in circles a bit and have ended up at the same place several times..

The One thing that seems to not be working right is the findInList as it seems to not be allowing me to actually find the Key in the active Key list:

Anyway the code I have for the what I am doing is this right now..

I have edited out everything that is not being worked on:

Code: [Select]



// Included Libraries
#include <Keypad.h>


// Variable Declaration
String msg;
int enc;
int encA;
int encB;
int Afound;
int Bfound;
#define PSE9r 3
#define PSE9c 7


//Define Button Matrix Options and Pin Map
byte PSE9[PSE9r][PSE9c] = {
  { 8, 9, 10, 11, 12, 13, 14},
  { 21, 15, 16, 17, 18, 19, 20},
  { 22, 23, 24, 25, 26, 27, 28}
};
byte PSE9rPins[PSE9r] = { 22, 21, 20};    //row pinouts
byte PSE9cPins[PSE9c] = { 19, 18, 17, 16, 15, 14, 13};    //column pinouts


//initialize Keypad Physical Matrix
Keypad PSE9matrix = Keypad( makeKeymap(PSE9), PSE9rPins, PSE9cPins, PSE9r, PSE9c);


// Program
void setup() {
  Serial.begin(500000);
  PSE9matrix.setDebounceTime(0);    // Default is 50mS
  PSE9matrix.setHoldTime(10000);    // Default is 500mS
}

void loop() {
    CheckEncoders9();
}

// Encoder Program
void CheckEncoders9(void){
   // Check for Single Button usage or Run Encoder Coding
  if (PSE9matrix.getKeys()) {
    for (int i=0; i<LIST_MAX; i++) {    // Scan the whole key list.
      if (PSE9matrix.key[i].stateChanged ) {    // Only find keys that have changed state.
        if (PSE9matrix.key[i].kchar == 8 ||PSE9matrix.key[i].kchar == 21 || PSE9matrix.key[i].kchar == 22) {  
          switch (PSE9matrix.key[i].kstate) {    // Report active key state : IDLE, PRESSED, HOLD, or RELEASED
          case PRESSED:
            msg = " pressed";
            Joystick.button(PSE9matrix.key[i].kchar, 1);
          break;
          case RELEASED:
            msg = " released";
            Joystick.button(PSE9matrix.key[i].kchar, 0);
          break;
          }
        byte s = PSE9matrix.key[i].kchar;
        Serial.print("Button ");
        Serial.print(s);
        Serial.print(" is");
        Serial.println(msg);
        } else {
          // Determine Active Encoder A or B
            enc = PSE9matrix.key[i].kchar;
          if ( PSE9matrix.key[i].kchar % 2 == 0 ){
            encA = enc - 1;
            encB = enc;
            Afound = PSE9matrix.findInList(encA);
            Bfound = PSE9matrix.findInList(encB);
          }else{
            encA = enc;
            encB = enc + 1;
            Afound = PSE9matrix.findInList(encA);
            Bfound = PSE9matrix.findInList(encB);
          }
          byte n = PSE9matrix.key[i].kstate;
          Serial.print("Encoder ");
          Serial.print(encA);
          Serial.print(" ");
          Serial.println(encB);
          Serial.print("Encoder State ");
          Serial.println(n);
          switch (PSE9matrix.key[i].kstate) {    // Report active key state : IDLE, PRESSED, HOLD, or RELEASED
            case PRESSED:
              msg = " pressed";
              Joystick.button(PSE9matrix.key[i].kchar, 1);
            break;
            case HOLD:
              msg = " held";
            break;
            case RELEASED:
              msg = " released";
              Joystick.button(PSE9matrix.key[i].kchar, 0);
            break;
            case IDLE:
              msg = " idle";
            break;
          }
          Serial.print("A Encoder Found = ");
          Serial.println(Afound);
          Serial.print("B Encoder Found = ");
          Serial.println(Bfound);
          byte s1 = PSE9matrix.key[i].kchar;
          Serial.print("Encoder Button ");
          Serial.print(s1);
          Serial.print(" is");
          Serial.println(msg);
        }
      }  
    }
  }  
}


I have an encoder connected with Ground on Pin 20 and Output A on Pin 14 - Matrix [3] [6] for button 27 and Output B on Pin 13 -Matrix [3] [7] for button 28.

continued next post...
Pages: [1] 2 3 ... 10