(Arduino study) LED brightness change by pwm ( analogWrite function )

A analogWrite function generate PWM pules easy.
It can use to a motor control.

very very simple source code.
int ledPin = 10;

void setup(){

void loop(){
  //increase brightness step by +5
  for(int fadeValue = 0; fadeValue < 256; fadeValue +=5)
    analogWrite(ledPin, fadeValue);
    delay(30); //wait 0.01sec
  //decrease brightness step by -5
  for(int fadeValue=255; fadeValue >=0; fadeValue-=5)
    analogWrite(ledPin, fadeValue);
    delay(30); //wait 0.01sec


Popular posts from this blog

OpenCV Stitching example (Stitcher class, Panorama)

(OpenCV Study) Background subtractor MOG, MOG2, GMG example source code (BackgroundSubtractorMOG, BackgroundSubtractorMOG2, BackgroundSubtractorGMG)

Example source code of extract HOG feature from images, save descriptor values to xml file, using opencv (using HOGDescriptor )

Real-time N camera stitching Class.

8 point algorithm (Matlab source code) / The method to get the Fundamental Matrix and the Essential matrix

Optical Flow sample source code using OpenCV

Video Stabilization example source code, (using cvFindHomography, cvWarpPerspective functions in openCV)

(OpenCV Study) calcOpticalFlowFarneback example source code ( dense optical flow )

yuv422(YUYV) to RGB and RGB to yuv422(YUYV), (Using OpenCV and TBB)

(C, C++) TinyXML , xml read & write