Use doubles in Examlpe 11
Updated Example 11 to use all <double> instead of <int> for RGB LED.
This commit is contained in:
		
							parent
							
								
									1347e4fd5c
								
							
						
					
					
						commit
						3e4ada5912
					
				|  | @ -136,12 +136,11 @@ struct DEV_RgbLED : Service::LightBulb {            // RGB LED (Command Cathode) | ||||||
|   StatusCode update(){                              // update() method
 |   StatusCode update(){                              // update() method
 | ||||||
| 
 | 
 | ||||||
|     boolean p; |     boolean p; | ||||||
|     int v; |     double v, h, s, r, g, b; | ||||||
|     double h, s, r, g, b; |  | ||||||
| 
 | 
 | ||||||
|     h=H->getVal<double>();       // get all current values
 |     h=H->getVal<double>();       // get all current values
 | ||||||
|     s=S->getVal<double>(); |     s=S->getVal<double>(); | ||||||
|     v=V->getVal<int>(); |     v=V->getVal<double>(); | ||||||
|     p=power->getVal<boolean>(); |     p=power->getVal<boolean>(); | ||||||
| 
 | 
 | ||||||
|     char cBuf[128]; |     char cBuf[128]; | ||||||
|  | @ -173,10 +172,10 @@ struct DEV_RgbLED : Service::LightBulb {            // RGB LED (Command Cathode) | ||||||
|     LOG1(cBuf); |     LOG1(cBuf); | ||||||
| 
 | 
 | ||||||
|     if(V->isUpdated){ |     if(V->isUpdated){ | ||||||
|       v=V->getNewVal<int>(); |       v=V->getNewVal<double>(); | ||||||
|       sprintf(cBuf,"V=%d->%d ",V->getVal<int>(),v); |       sprintf(cBuf,"V=%d->%d ",(int)V->getVal<double>(),(int)v); | ||||||
|     } else { |     } else { | ||||||
|       sprintf(cBuf,"V=%d  ",v); |       sprintf(cBuf,"V=%d  ",(int)v); | ||||||
|     } |     } | ||||||
|     LOG1(cBuf); |     LOG1(cBuf); | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	 Gregg
						Gregg