Recent Posts

Pages: [1] 2 3 ... 10
1
Okay, I will give it a try. I am new to the code stuff, so how would you write that part(Or which pins use OUTPUT and etc?)? The input on the controller says from 5-24v so I can check it. I could possibly get a 5v power supply instead of a 12v to bypass that if it is on 12v. Thanks
2
Programming Questions / Re: toneMelody...without a ton...
Last post by UKHeliBob - Aug 14, 2018, 11:59 pm
Nothing in the code changes the state of the buzzer pin so how is it ever going to make a noise ?

Just as baffling is that you have a series of notes in the song array and never read anything from the array.
3
Programming Questions / Re: Exception (0) where is the...
Last post by DKWatson - Aug 14, 2018, 11:59 pm
if((long)(micros() - last_micros) >= 5 * 1000)
What is the operator precedence here? Perhaps some more parentheses? And why the cast?
4
MKRVIDOR4000 / Re: ESP32
Last post by DarioPennisi - Aug 14, 2018, 11:58 pm
As you can see from schematics fpga.is connected to almost all pins of Nina so if you want you can route Nina pins to mkr connector or to mini PCIe. At the moment current images can only use Nina pins as iOS to/from fpga.
5
Deutsch / Re: Spannung des Schrittmotors...
Last post by gregorss - Aug 14, 2018, 11:57 pm
Andererseits welchen Sinn hat es einen 2€ Motor mit einem 10€ Treiber anzusteuern. Ein Stromtreiber mit Microschritten wird den Motor niemals gut ansteuern.
Wenn es ums Hobby geht, scheuen wir keine Kosten. Wir müssen allerdings manchmal sparen - egal, was es kostet.

Am Ende landet das Gebastel am Carbon-Rahmen des Drahtesels, den sich eine schlipstragende Rübennase ohne Kondition in den Keller gestellt hat. Dort fängt es dann Staub, der anderswo vielleicht dringend benötigt wird. Schande, das.

Gruß

Gregor
6
Programming Questions / Re: toneMelody...without a ton...
Last post by slipstick - Aug 14, 2018, 11:57 pm
Provide a link to the "Melodytone example sketch" and we can go from there. Did you actually mean Tone Melody? If so you left out the tone() command...and that's the one that makes the noise.

Steve
7
General Electronics / Re: Breadboard Compatibility?
Last post by TomGeorge - Aug 14, 2018, 11:53 pm
Hi,
For the ESP32 I put connected two of these boards side by side and straddled the two power bus strips with the ESP32.
So your prototyping area is doubled width wise.

Tom... :)
8
Deutsch / Re: Spannung des Schrittmotors...
Last post by uwefed - Aug 14, 2018, 11:51 pm
Hi

Man kann den 28BYJ-48 auf BI-Polar umbauen.
Siehe dieses PDF
Hier kann man nachlesen, daß der Umbau auch deutlich mehr Kraft liefern soll.
Und hier gibt's was zur Ansteuerung des Original-Motor via Stepper-Library (also ohne Umbau).

MfG
Der Motor ist für eine Verlustleistung ausgelegt die sich aus der Bestromung mit Nennstrom jeweils einer Halbspule (Mittelanzapfung zu Außenanschluß) ergibt. Wenn Du nun auf die gesamte Wicklung den Nennstrom gibst dann hast Du das doppelte Drehmoment, aber auch die doppelte Verlustleistung.

Andererseits welchen Sinn hat es einen 2€ Motor mit einem 10€ Treiber anzusteuern. Ein Stromtreiber mit Microschritten wird den Motor niemals gut ansteuern.

Grüße Uwe
9
Programming Questions / Re: How can you connect 2 pins...
Last post by DrAzzy - Aug 14, 2018, 11:51 pm
The "general" approaches to connecting two wires are not appropriate here (you'd need a relay or something - bulky, current hungry, and awkwardly large.

There are much simpler ways, but you need to figure out how those controls are wired.

Get out your DMM, test continuity - I'll wager than one of those pins is tied to ground, and the other is pulled up by the controller. Check which is which, and to what voltage the one not grounded is tied to - if it's 5v or less, that can go direct to an arduino pin. Set the pin to OUTPUT to drive it low and simulate a button press. If it's to the full 12v, connect it to the drain of a small logic level MOSFET, ground to the source of said MOSFET, and gate through a small resistor (100 ohms is good, but you can go up to a couple k in a low-current situation like this, and in practice with small fets, you don't even need it - though it's always good practice)

In all cases, ground of controller should be tied to ground of the arduino. If this is a problem, use an opto (but you still need to know the polarity) to isolate it from the arduino ground.


If one of them isn't wired to ground, gather more data and post back.
10
Project Guidance / Re: Code runs properly only wh...
Last post by pgsmick - Aug 14, 2018, 11:51 pm
Here is the last of the code.  Sorry for the piecemeal nature of this.  Is there some way around the 9000 character limit?

Code: [Select]


void HAZARD_SHORT()
{
 if (HAZARD_L_STATE == HIGH)  //turn HAZARD_L_STATE off if it is on
 {
  HAZARD_L_STATE = !HAZARD_L_STATE;
 }
 HAZARD_S_STATE = !HAZARD_S_STATE;
}

void HAZARD_LONG()
{
 if (HAZARD_S_STATE == HIGH) //turn HAZARD_S_STATE off if it is on
 {
  HAZARD_S_STATE = !HAZARD_S_STATE;
 }
 HAZARD_L_STATE = !HAZARD_L_STATE;
}


void HAZ_S_BLINK()
{
  //HAZARD lights will be toggled only if more time has passed than the FLASH_INTERVAL_SHORT
  //AND we have not exceeded the maximum allowed for the hazard function.
  if (((LOOPTIME) - (HAZARD_TIME) >= (FLASH_INTERVAL_SHORT)) && (HAZARD_COUNT <= MAX_HAZARD_COUNT))
  {
    SWITCH_HAZARD_S();
    if (TwoWire==false)
    {
    digitalWrite(Lrun,LOW);
    digitalWrite(Rrun,LOW);
    }
  }
  if (HAZARD_COUNT > MAX_HAZARD_COUNT)
  {
    LIGHTS_NORMAL();
  }
}

void SWITCH_HAZARD_S()
{
  //Routine toggles the signal lights on or off, increments the count of half-cycles, and records the time this is done
  HAZARD_TIME=millis();
  HAZARD_LIGHTS_STATE= !HAZARD_LIGHTS_STATE;
  HAZARD_COUNT=HAZARD_COUNT + 1;
  digitalWrite(Lout,HAZARD_LIGHTS_STATE);
  digitalWrite(Rout,HAZARD_LIGHTS_STATE);

  //Serial.print("We're here, and 2-wire is: "); Serial.println(TwoWire);
  //Serial.print("HAZARD_LIGHTS_STATE is: "); Serial.println(HAZARD_LIGHTS_STATE);
  
  if (TwoWire==true)
  {
    digitalWrite(Lrun,HAZARD_LIGHTS_STATE);
    digitalWrite(Rrun,HAZARD_LIGHTS_STATE);
  }
}

void HAZ_L_BLINK()
    //HAZARD lights will be toggled only if more time has passed than the FLASH_INTERVAL_LONG
    //It will flash the lights indefinitely and risks running down the battery.
{
  if (((LOOPTIME) - (HAZARD_TIME)) >= (FLASH_INTERVAL_LONG))
  {
    SWITCH_HAZARD_L();
    if(TwoWire==false)
    {
      digitalWrite(Lrun,LOW);
      digitalWrite(Rrun,LOW);
    }
  }
}

void SWITCH_HAZARD_L()
{
  HAZARD_TIME=millis();
  HAZARD_LIGHTS_STATE= !HAZARD_LIGHTS_STATE;
  digitalWrite(Lout,HAZARD_LIGHTS_STATE);
  digitalWrite(Rout,HAZARD_LIGHTS_STATE);
  if (TwoWire==true)
  {
    digitalWrite(Lrun,HAZARD_LIGHTS_STATE);
    digitalWrite(Rrun,HAZARD_LIGHTS_STATE);
  }
}

void L_SIGNAL_BLINK()
  //Blinks LEFT signal until MAX_SIGNAL_COUNT is reached.  SIGNAL_COUNT is in half-cycles.
{
  if ( ((LOOPTIME) - (SIGNAL_TIME)) >= (FLASH_INTERVAL)  && (SIGNAL_COUNT <= MAX_SIGNAL_COUNT))
  {
    digitalWrite(Lrun,LOW);
    digitalWrite(Rout,LOW);   //switching directly left to right
    if (TwoWire == true) analogWrite(Rrun,PWMBrightness);
    else digitalWrite(Rrun,HIGH);
    SWITCH_L_SIGNAL();
  }
  if ((SIGNAL_COUNT) > (MAX_SIGNAL_COUNT))
  {
    L_SIGNAL_ON = false;
    digitalWrite(Lout,LOW);
    //Serial.print("TwoWire="); Serial.println(TwoWire);
    if (TwoWire == true) analogWrite(Lrun,PWMBrightness);
    else     digitalWrite(Lrun,HIGH);
  }
  
}

void SWITCH_L_SIGNAL()
  //Actually toggles the LEFT signal on or off.
{
 SIGNAL_TIME = millis();
 SIGNAL_COUNT=SIGNAL_COUNT + 1 ;
  L_OUT_STATE= !L_OUT_STATE;
 digitalWrite(Lout,L_OUT_STATE);
 if (TwoWire == true) digitalWrite(Lrun,L_OUT_STATE);
}

void R_SIGNAL_BLINK()
  //Blinks RIGHT signal until MAX_SIGNAL_COUNT is reached.   SIGNAL_COUNT is in half-cycles.
{
  if ((((LOOPTIME) - (SIGNAL_TIME)) >= (FLASH_INTERVAL))  && (SIGNAL_COUNT <= MAX_SIGNAL_COUNT))
  {
    //Here we need to make provisions for 2-wire signals
    digitalWrite(Rrun,LOW);
    digitalWrite(Lout,LOW);   //switching directly right to left
    if (TwoWire == true) analogWrite(Lrun,PWMBrightness);
    else digitalWrite(Lrun,HIGH);
    SWITCH_R_SIGNAL();
  }
  if ((SIGNAL_COUNT) > (MAX_SIGNAL_COUNT))
  {
    R_SIGNAL_ON = false;
    digitalWrite(Rout,LOW);
    if (TwoWire == true) analogWrite(Rrun,PWMBrightness);
    else digitalWrite(Rrun,HIGH);
  }
}

void SWITCH_R_SIGNAL()
  //Actually toggles the RIGHT signal on or off.
{
 SIGNAL_TIME = millis();
 SIGNAL_COUNT=SIGNAL_COUNT + 1 ;
 R_OUT_STATE= !R_OUT_STATE;
 digitalWrite(Rout,R_OUT_STATE);
 if (TwoWire == true) digitalWrite(Rrun,R_OUT_STATE);
}

void LIGHTS_NORMAL()
{
 //Sets the lights to normal without modifying any variable used to test conditions.

  digitalWrite(AltPower,LOW);
  digitalWrite(Lout,LOW);
  digitalWrite(Rout,LOW);
  if (TwoWire == true)
  {
    analogWrite(Lrun,PWMBrightness);
    analogWrite(Rrun,PWMBrightness);
  }
  else
  {
    digitalWrite(Lrun,HIGH);
    digitalWrite(Rrun,HIGH);
  }
}

void RESET_VARIABLES()
  //take care of variables that need resetting when all functions have returned to normal status.
{
  SIGNAL_COUNT=0;
  HAZARD_COUNT=0;
  HAZARD_S_STATE=0;
}


Pages: [1] 2 3 ... 10