login

online now

We have 135 guests and no members online

search

 
Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC: Tone Generation with Light Sensing LEDs

Tone Generation with Light Sensing LEDs 5 years 7 months ago #278

I have successfully written code to get an LED in light sensing mode to turn on an LED in light emitting mode based on user touch. In other words, the person covers one LED and the other LED comes on.

What I am now trying to do is get a GinSing produced tone in poly mode to play when the LED is touched. I can't seem to figure it out. Here is my code:
#include <GinSing.h>                                           
GinSing  GS;                                                   

#define rcvPin  4                                              
#define sndPin  3                                              
#define ovfPin  2

int sense01 = 0;
int LED01 = 11;
int val01 = 0;
int light1 = 270;

void setup()
{  
  
  Serial.begin(9600);
  pinMode(LED01, OUTPUT);
}

void loop()
{
GS.begin ( rcvPin , sndPin , ovfPin );                         
  GinSingPoly * poly = GS.getPoly();                         
  poly->begin ();               

val01 = analogRead(sense01);  

Serial.println(val04);

if (val01 >= light1)
{digitalWrite(LED01, LOW);
}
else {
  digitalWrite(LED01, HIGH);
  poly->setNote ( A_4 , 0);
  poly->trigger (A_4);
}    
}
Last Edit: 5 years 7 months ago by administrator.
The administrator has disabled public write access.

Re: Tone Generation with Light Sensing LEDs 5 years 7 months ago #281

Please see this post:

Tone Generation
Last Edit: 5 years 7 months ago by administrator.
The administrator has disabled public write access.
  • Page:
  • 1
Time to create page: 0.147 seconds