Show Posts
Pages: [1]
1  Using Arduino / Programming Questions / Re: Increment PWM! on: September 14, 2013, 08:57:18 am
Thank you Sir! You just made my day, it works just fine smiley-grin
2  Using Arduino / Programming Questions / Re: Increment PWM! on: September 14, 2013, 06:55:20 am
Could you post the whole code so it's easier to see what's going on in other parts of the program?
Best regards!
3  Using Arduino / Programming Questions / Re: Increment PWM! on: September 14, 2013, 05:23:10 am
The EnablePin doesn't seem to work properly, that's where I put out the PWM.

Code:
void Increment_pwm(){
  //for(int i =0; i<=255; i++)
  //i += 50;
  analogWrite(EnablePin, i);
  digitalWrite(Motor1Pin2, LOW);
  digitalWrite(Motor1Pin1, HIGH);
}

void Decrement_pwm(){
  for(int i=255; i>=0; i--)
  //i -= 1;
  analogWrite(3,i);
}

I want to keep the PWM-value, have it stored and then it can increment / decrement from its last value.
4  Using Arduino / Programming Questions / Re: Increment PWM! on: September 14, 2013, 05:17:18 am
http://www.instructables.com/id/Control-your-motors-with-L293D-and-Arduino/

It's a motor driver and you can use PWM for controlling the speed, and I want to
implement that via IR-receiver. Everything works fine except the PWM-part
5  Using Arduino / Programming Questions / Increment PWM! on: September 14, 2013, 05:03:23 am
Good day Arduino-society!

I'm curious as how I can make PWM-increment / decrement possible with my L293D motor driver IC,
currently using this code but it don't work as I want it to do.

Code:
#include <IRremote.h>

int IRpin = 11;  // pin for the IR sensor
IRrecv irrecv(IRpin);
decode_results results;

const int Motor1Pin1 = 4;
const int Motor1Pin2 = 7;
//const int Motor2Pin1 = 8;
//const int Motor2Pin2 = 12;
const int EnablePin = 3;
int i = 0;

void setup() {     
  Serial.begin(9600); 
  pinMode(Motor1Pin1, OUTPUT);   
  pinMode(Motor1Pin2, OUTPUT);   
  //pinMode(Motor2Pin1, OUTPUT);   
  //pinMode(Motor2Pin2, OUTPUT);
  pinMode(EnablePin, OUTPUT);
  irrecv.enableIRIn(); // Start the receiver
  //analogWrite(3, i);
}


void loop() {
 
  if (irrecv.decode(&results))
    {
     
      irrecv.resume();   // Receive the next value
    }
 
  switch(results.value)
 {

  case 3261853764:
  GoForward();
  break;
 
  case 3305092678:
  GoBackward();
  break;
 
  case 2331063592:
  Stop();
  break;
 
  case 1752382022:
  Increment_pwm();
  break;
 
  case 2209452902:
  Decrement_pwm();
  break;
 
  default:
  Stop();
 
  }
 
}

void GoForward(){
  digitalWrite(Motor1Pin2, LOW);
  digitalWrite(Motor1Pin1, HIGH);
  //digitalWrite(Motor2Pin2, LOW);
  //digitalWrite(Motor2Pin1, HIGH);
}

void GoBackward(){
  digitalWrite(Motor1Pin1, LOW);
  digitalWrite(Motor1Pin2, HIGH);
  //digitalWrite(Motor2Pin1, LOW);
  //digitalWrite(Motor2Pin2, HIGH);
}

void GoLeft(){
  digitalWrite(Motor1Pin1, LOW);
  digitalWrite(Motor1Pin2, HIGH);
  //digitalWrite(Motor2Pin2, LOW);
  //digitalWrite(Motor2Pin1, HIGH);
}

void GoRight(){
  digitalWrite(Motor1Pin2, LOW);
  digitalWrite(Motor1Pin1, HIGH);
  //digitalWrite(Motor2Pin1, LOW);
  //digitalWrite(Motor2Pin2, HIGH);
}

void Stop(){
  digitalWrite(Motor1Pin2, LOW);
  digitalWrite(Motor1Pin1, LOW);
  //digitalWrite(Motor2Pin1, LOW);
  //digitalWrite(Motor2Pin2, LOW);
}

void Increment_pwm(){
  //for(int i =0; i<=255; i++)
  //i += 50;
  analogWrite(EnablePin, i);
  digitalWrite(Motor1Pin2, LOW);
  digitalWrite(Motor1Pin1, HIGH);
}

void Decrement_pwm(){
  for(int i=255; i>=0; i--)
  //i -= 1;
  analogWrite(3,i);
}
 

Someone got any suggestions ? Best regards, Tesla_pow
6  Using Arduino / LEDs and Multiplexing / Re: LED dimmer w/ Processing on: December 14, 2012, 10:48:17 am
-
7  Using Arduino / LEDs and Multiplexing / LED dimmer w/ Processing on: December 14, 2012, 08:32:17 am
-
8  Using Arduino / Project Guidance / Re: AC dimmer 220V 50Hz on: November 24, 2012, 01:11:03 pm
Could you repost your schematic KNYAZ 2020  ? Can't see the schematic you've posted some time ago,
I've tried out some other circuits but this one I think is close. http://postimage.org/image/epi813wmx/
Thing is, in the simulation program there is just MOC3021 and I've tried out your code in my simulation. Looked at the
datasheets for 4N35, MOC3021 and the triac BT139. Tried adjusting the forward and holding currents on triac manually
but with no luck. The bridge rectifier is a 400V 1A,and triac is currently standing on 1mA forward and 5mA holding current. Someone who can help me on this ?
Pages: [1]