Teensy 3.6 code not running on 5 Volt external power

Status
Not open for further replies.

Kumalix

New member
Hi,

I just recently switched to Teensy from Arduino Due.

Now when i program teensy 3.6 with USB power (external power disconnected).
Code gets exicuted perfectly.

Than i disconnect USB and connect extrenal power to VIN and ANALOG GROUND. Now the code does not get executed.
Is there something that i need to do so Teensy remembers the code? Or? When checking with multimeter theensy is powered!

I have read a lot of posts on this forum but they al relate to using External power and USB. Cutting the Vin and USB on the bottom or the red wire of the usb.
But is it possible to do it like above?

tnx for the help. Any comment is welcom!
N
 
Following top of page 'Forum Rule' would help here - save speculation - can't see the code? Suspect where is something like this in setup() : while ( !Serial );

When not connected to active USB this code will sit and wait forever stopping the rest of the program from running.
 
Hi, Sry for ignoring Forum Rules.

This is my code.


Code:
#include <AccelStepper.h>
AccelStepper stepperR(AccelStepper::DRIVER, 4, 3);     // (Step, Directon)
AccelStepper stepperL(AccelStepper::DRIVER, 7, 6);     // (Step, Directon)
int enableR = 5;
int enableL = 2;


///////SENSOREN//////////
const int ENDpninnenPIN = 32;
const int HOMEpinnenPIN = 31;
const int HOMEuitbreekplaatPIN = 30;
int ENDpinnenSTATE;
int HOMEpinnenSTATE;
int HOMEuitbreekplaatSTATE;

///////CONTROLE BOARD BUTTONS-LEDS////////
const int UP = 25; // Groene draad
const int DOWN = 11; //Witte draad
int UPstate;
int DOWNstate;

boolean atStartPosition;

void setup() {//================================================================
  //Serial.begin(115200);
  stepperR.setMaxSpeed(90000); // 90.000
  stepperR.setAcceleration(100000); // 100.000
  stepperL.setMaxSpeed(90000);//90.000
  stepperL.setAcceleration(100000); // 100.000


  pinMode(ENDpninnenPIN, INPUT);  
  pinMode(HOMEpinnenPIN, INPUT);
  pinMode(HOMEuitbreekplaatPIN, INPUT);
  pinMode(UP, INPUT_PULLDOWN);
  pinMode(DOWN, INPUT_PULLDOWN);


   pinMode(enableL, OUTPUT);
   pinMode(enableR, OUTPUT);
  //digitalWrite(enableL, HIGH);
  //digitalWrite(enableR, HIGH);

}
void loop() {//=========================================================
  ENDpinnenSTATE = digitalRead(ENDpninnenPIN);
  HOMEpinnenSTATE = digitalRead(HOMEpinnenPIN);
  HOMEuitbreekplaatSTATE = digitalRead(HOMEuitbreekplaatPIN);

  UPstate = digitalRead(UP);
  DOWNstate = digitalRead(DOWN);


  if (UPstate == 1){
  stepperR.moveTo(72500);
  stepperL.moveTo(72500);
  stepperR.run();
  stepperL.run();
  }

 if (DOWNstate == 1){
  stepperR.moveTo(0);
  stepperL.moveTo(0);
  stepperR.run();
  stepperL.run();
  }

  
  //Serial.print(ENDpinnenSTATE);
  //Serial.print(HOMEpinnenSTATE);
  //Serial.println(HOMEuitbreekplaatSTATE);
  //Serial.print(UPstate);
  //Serial.print("DOWNstate:");
  //Serial.println(DOWNstate);
  //Serial.println (digitalRead(homeL));
}
 
Than i disconnect USB and connect extrenal power to VIN and ANALOG GROUND. Now the code does not get executed.
Obviously you should connect external power to VIN and GND (the two top pins left and right to the USB connector)
 
Analog ground has a filter circuit on it which would tend to do odd things to the reset generation during power on even if it measures OK once stabilised. Others have had trouble with Teeny3.6 on external power if the 5V signal rise is slow. If nothing else is working it may be useful to manually trigger the reset pin once power is up and stable and see if it starts correctly then.
 
Status
Not open for further replies.
Back
Top