Skip to content

Instantly share code, notes, and snippets.

@mikekavouras
Created December 7, 2015 17:58
Show Gist options
  • Select an option

  • Save mikekavouras/7c531f078c3c000df27d to your computer and use it in GitHub Desktop.

Select an option

Save mikekavouras/7c531f078c3c000df27d to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <math.h>
int main()
{
float pi = 3.141592;
float i;
float bulb1;
float bulb2;
float bulb3;
int bulbs_num;
float offset;
bulbs_num = 3;
offset = 100/bulbs_num;
for (i = 0; i < 2 * pi;i = i + pi/10 ){
bulb1 = (sin(i-(pi/2)) + 1) * 50;
bulb2 = (sin((i + offset)-(pi/2)) + 1) * 50;
bulb3 = (sin((i + 2 * offset)-(pi/2)) + 1) * 50;
printf("Bulb One Brightness: ");
printf("%9.6f", bulb1);
printf("\n");
printf("Bulb Two Brightness: ");
printf("%9.6f", bulb2);
printf("\n");
printf("Bulb Three Brightness: ");
printf("%9.6f", bulb3);
printf("\n");
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment