Electronic Components Datasheet Search
  English  ▼
ALLDATASHEET.NET

X  

DEV-13042 Datasheet(PDF) 6 Page - SparkFun Electronics

Part # DEV-13042
Description  SparkFun Blocks for Intel짰 Edison - PWM
PDF  9 Pages
Scroll/Zoom Zoom In 100%  Zoom Out
Manufacturer  SPARKFUN [SparkFun Electronics]
Direct Link  https://www.sparkfun.com/
Logo SPARKFUN - SparkFun Electronics

DEV-13042 Datasheet(HTML) 6 Page - SparkFun Electronics

  DEV-13042 Datasheet HTML 1Page - SparkFun Electronics DEV-13042 Datasheet HTML 2Page - SparkFun Electronics DEV-13042 Datasheet HTML 3Page - SparkFun Electronics DEV-13042 Datasheet HTML 4Page - SparkFun Electronics DEV-13042 Datasheet HTML 5Page - SparkFun Electronics DEV-13042 Datasheet HTML 6Page - SparkFun Electronics DEV-13042 Datasheet HTML 7Page - SparkFun Electronics DEV-13042 Datasheet HTML 8Page - SparkFun Electronics DEV-13042 Datasheet HTML 9Page - SparkFun Electronics  
Zoom Inzoom in Zoom Outzoom out
 6 / 9 page
background image
//  after the code has completed. 
int main() 
{ 
  // Variables to be used elsewhere in the program. 
  uint16_t startTime, stopTime; 
  mraa::I2c* pwm_i2c;   // We need to create an I2c object tha
t we can pass to 
                        //  the pca9685 constructor. If you ha
ve more than one 
                        //  PCA9685 device on your bus (eithe
r by stacking more 
                        //  than one PWM block or by adding ex
ternal boards via 
                        //  the I2C Expansion Block), you'll n
eed to create a 
                        //  different I2c object for each one! 
  pwm_i2c = new mraa::I2c(1); // Tell the I2c object which bu
s it's on. 
  pca9685 pwm(pwm_i2c, 0x40); // 0x40 is the default address f
or the PCA9685. 
  // In general usage, you don't need to worry about getting o
r setting the 
  //  mode registers or the prescaler register. I'm including 
these lines here 
  //  just for example completeness purposes. 
  cout<<"Current mode register values: 0x"<<hex<<pwm.readModeR
egisters()<<endl; 
  cout<<"Current prescaler: "<<dec<<static_cast<int16_t>(pwm.g
etPrescaler())<<endl; 
  pwm.setPrescaler(121); 
  // There are four generic functions allowing the user to cha
nge the start and 
  //  stop times of the various channels. Generally, however, 
you shouldn't ever 
  //  have to or want to use these, since there are more usefu
l functions 
  //  available which will be covered below. 
  pwm.setChlTime(RED, 0, 0); 
  pwm.setChlDuty(BLUE, 0); 
  pwm.setChlStart(GREEN, 0); 
  pwm.setChlStop(GREEN, 0); 
  pwm.setChlDuty(SERVO, 0); 
#ifdef LED_DEMO 
  // When you call enableLEDMode(), you set the output to be a
pproximately 400Hz 
  //  and inverted. Thus, a 0 output will be a 100% high outpu
t. This allows us 
  //  to use the output to drive common anode LEDs. See the tu
torial for an 
  //  example circuit. 
  pwm.enableLEDMode(); 
  // Back to this, just so you can compare the settings in LE
D mode with the 
  //  default (which is actually LED mode). 
  cout<<"Current mode register values: "<<hex<<pwm.readModeReg
isters()<<endl; 
  cout<<"Current prescaler: "<<dec<<static_cast<int16_t>(pwm.g
etPrescaler())<<endl; 
  for (uint8_t i = 0; i <= 100; i++) 
Page 6 of 9



Html Pages

1 2 3 4 5 6 7 8 9


Datasheet Download

Go To PDF Page


Link URL



Does ALLDATASHEET help your business so far?  [ DONATE ] 

About Alldatasheet   |   Advertisement   |   Contact us   |   Privacy Policy   |   Link to Datasheet    |   Link Exchange   |   Manufacturer List
All Rights Reserved©Alldatasheet.com


Mirror Sites
English : Alldatasheet.com  |   English : Alldatasheet.net  |   Chinese : Alldatasheetcn.com  |   German : Alldatasheetde.com  |   Japanese : Alldatasheet.jp
Russian : Alldatasheetru.com  |   Korean : Alldatasheet.co.kr  |   Spanish : Alldatasheet.es  |   French : Alldatasheet.fr  |   Italian : Alldatasheetit.com
Portuguese : Alldatasheetpt.com  |   Polish : Alldatasheet.pl  |   Vietnamese : Alldatasheet.vn
Indian : Alldatasheet.in  |   Mexican : Alldatasheet.com.mx  |   British : Alldatasheet.co.uk  |   New Zealand : Alldatasheet.co.nz
Family Site : ic2ic.com  |   icmetro.com