Recent Posts

Pages: [1] 2 3 ... 10
1
Sensors / Re: HMC5883L
Last post by jremington - Today at 06:24 am
You MUST calibrate a magnetometer for it to be useful. Overview here.
2
Project Guidance / Re: Time measuring laser gate
Last post by Wawa - Today at 06:23 am
Why do people always think "laser".
A common IR diode as used in a remote control and a remote control receiver might be easier.
What distance are we talking about.
Leo..
3
General Electronics / Re: FYI Making DuPont jumper w...
Last post by DrAzzy - Today at 06:23 am
One more thing..... make sure to push the plastic tab in real good before inserting the wire/crimp assembly into the plastic casing. Use a tiny screw-driver or thin paper-clip, and push that tab inwards ----- right into the slot. Get a good inward angle on it. Do all this before inserting the metal/wire/crimp assembly into the plastic casing. Sometimes, wires slide out from the plastic casing only because the tabs were not properly pushed in (to get a good inward angle) to begin with.




I've only had to do this when re-using housings that I've removed the pins from previously. On new housings, they've always clipped right in for me. Do you find this necessary with brand new pins?
4
Software / Re: Tempo tra impulsi
Last post by elrospo - Today at 06:22 am
Con la programmazione diretta di un timer a che sensibilità riesco ad arrivare?
Buona giornata.
Samu
mah mi sa che quello che vuoi fare tu lo fa una centralina auto.  arduino è quello che è,

e il meccanismo automobilistico ha una ruota fonica di 60 denti  meno uno

quindi... valutare bene quello che si "pretende" e una centralina auto  non è solo un micro 100 volte piu performante di arduino ha anche chip per sensori dedicati etc 


5
No. Please post the latest sketch.
Here it is.
Code: [Select]
#include <AccelStepper.h>
#include <string.h>
#include <stdio.h>
#define HALFSTEP 8

// Motor pin definitions
#define motorPin1  8     // IN1 on the ULN2003 driver 1
#define motorPin2  7     // IN2 on the ULN2003 driver 1
#define motorPin3  5     // IN3 on the ULN2003 driver 1
#define motorPin4  6     // IN4 on the ULN2003 driver 1
#define motorPin5  9     // IN1 on the ULN2003 driver 2
#define motorPin6  12     // IN2 on the ULN2003 driver 2
#define motorPin7  11     // IN3 on the ULN2003 driver 2
#define motorPin8  10     // IN4 on the ULN2003 driver 2

// Initialize with pin sequence IN1-IN3-IN2-IN4 for using the AccelStepper with 28BYJ-48
AccelStepper stepper1(HALFSTEP, motorPin1, motorPin3, motorPin2, motorPin4);
AccelStepper stepper2(HALFSTEP, motorPin5, motorPin7, motorPin6, motorPin8);

#define SOP '<'
#define EOP '>'
#define MID ','
float elevation = 03100.73;
float azimuth = 02502.54;
const byte numChars = 19;
char receivedChars[numChars];
char tempChars[numChars];
char dataFromPC[numChars] = {0};
float elevFromPC = 0.0;
float aziFromPC = 0.0;
boolean newData = false;

void setup() {
  Serial.begin(9600);
  delay(250);
  Serial.write("Arrrre you ready kids?"); //Sends a message to PC to confirm connection
  delay(1000);
  stepper1.setMaxSpeed(1000.0);
  stepper1.setAcceleration(500.0);
  stepper1.setSpeed(500);
  stepper2.setMaxSpeed(1000.0);
  stepper2.setAcceleration(500.0);
  stepper2.setSpeed(500);

}

///// ============== Somewhere below is the problem =============================================
void recvWithStartEndMarkers() {
  static boolean recvInProgress = false;
  static byte ndx = 0;
  char startMarker = '<';
  char endMarker = '>';
  char rc;
 
  while (Serial.available() > 0 && newData == false) {
    rc = Serial.read();
    if (recvInProgress == true) {
      if (rc != endMarker) {
        receivedChars[ndx] = rc;
        ndx++;
        if (ndx >= numChars) {
          ndx = numChars - 1;
        }
      }
      else {
        receivedChars[ndx] = '\0';
        recvInProgress = false;
        ndx = 0;
        newData = true;
      }
    }
    else if (rc == startMarker) {
      recvInProgress = true;
    }
  }
}

void parseData() {
  char * strtokIndx;
  strtokIndx = strtok(tempChars, ",");
  elevFromPC = atof(strtokIndx);
  strtokIndx = strtok(NULL, ",");
  aziFromPC = atof(strtokIndx);
}

void showParsedData() {
  Serial.println(elevation);
  Serial.println(azimuth);
}
////////////// ========================== Somewhere above is the problem ==============================

void loop() { //   \/ This part of the code works beautifully when I set elevation or azimuth = 12345.67
  recvWithStartEndMarkers();
  elevation = elevFromPC;
  azimuth = aziFromPC;
  if (newData == true) {
    strcpy(tempChars, receivedChars);
    parseData();
    showParsedData();
    newData = false;
  }
  stepper1.moveTo(azimuth);
  if (stepper1.distanceToGo() != 0) {
    stepper2.moveTo(azimuth);
  }
  if (stepper1.distanceToGo() == 0) {
    stepper2.moveTo(elevation);
  }
  stepper1.run();
  stepper2.run();
}
6
You'll need to measure the current, too.
7
Website and Forum / Re: Was the Forum software cha...
Last post by Wawa - Today at 06:13 am
That will be OK as long as they make the header small.  :)
No, it's not. Moving/hopping things are distracting and are covering other things.
And a larger header does nothing to enhance the forum part of the site.
Everybody on this forum knows the Arduino logo. No need to make it bigger.

A solution could be a bigger header when hovered over it.
Not sure what that does to a phone/tablet though.
Using Firefox on a 27" 1920x1200 monitor here (actually a triple setup).
Leo..
8
Quote
Does it matter if I have the loop() segment at the very end of the sketch?
No. Please post the latest sketch.
9
Right! Can't believe I missed that. Added that to loop(), yet I am still getting the same result. Is there anything wrong with the void parseData() segment? I suspect there might be, I am not entirely confident in what I did.

Does it matter if I have the loop() segment at the very end of the sketch?
10
General Electronics / Re: 123W AC Motor, I2C, an why...
Last post by Wawa - Today at 05:58 am
I am using the opto-coupled relay...

I am still using the arduino power supply to drive the coil of the relais...
So no opto isolation.

Driving the opto LED with the Arduino and powering the coil with the Arduino effectively shorts the opto coupler.
Leo..
Pages: [1] 2 3 ... 10