Electro-Tactile Display Stimulation

Fork of Stimulation by Sugarragchaa Khurelbaatar

Revision:
1:a45c4e14442c
Parent:
0:609c2f02a156
diff -r 609c2f02a156 -r a45c4e14442c Stimulation.cpp
--- a/Stimulation.cpp	Tue Jun 21 04:09:15 2016 +0000
+++ b/Stimulation.cpp	Wed Oct 26 09:02:39 2016 +0000
@@ -6,23 +6,27 @@
 Stimulation::Stimulation()
 {
     DAADinit();
-    hv507Init(1);   //initialize one HV507   
+    hv507Init(1);                               //initialize one HV507   
 }
 void Stimulation::begin()
 {
     hv507FastScan(0);
 }
-void Stimulation::setOn(unsigned char pin, short volume)
+void Stimulation::setOn(unsigned int pin, short volume, unsigned int pulsewidth)
 {
-    hv507FastScan(pin);
+    int t= pulsewidth/2;
+    if(pin!=0){
+        hv507FastScan(pin);
+    }
     HV507_BL = 1;
     HV507_LE = 1;
     HV507_LE = 0;
-    AD = DAAD(volume);  // Stimulation on
+    for(int i=0; i<t; i++) AD = DAAD(volume);   // Stimulation on
+    //AD = DAAD(volume);
 }
 void Stimulation::setOff()
 {
-    AD = DAAD(0);                       // Stimulation off
+    AD = DAAD(0);                               // Stimulation off
     HV507_BL = 0;
 }
 void Stimulation::end()