Voting resources, early voting, and poll worker information - VOTE. ... Adafruit is open and shipping.
0

Velosats
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Re: Velosats

by animefruit on Sat Feb 29, 2020 8:35 pm

This is Neal.So what should I use as the soft cushioning under the plate with the accelerometers?

animefruit
 
Posts: 169
Joined: Tue Feb 25, 2020 1:04 pm

Re: Velosats

by adafruit_support_bill on Sun Mar 01, 2020 7:36 am

Some soft foam would probably work.

adafruit_support_bill
 
Posts: 78979
Joined: Sat Feb 07, 2009 10:11 am

Re: Velosats

by animefruit on Sun Mar 01, 2020 11:57 am

This is Neal.Ok.I will try that.I will let you know if I have any more questions.

animefruit
 
Posts: 169
Joined: Tue Feb 25, 2020 1:04 pm

Re: Velosats

by animefruit on Sun Mar 01, 2020 4:13 pm

You said that I could filter out the values of what the accelerometer senses when someone is moving.So can’t I do that with my velosat also? It does values greater than zero when I touch it.What code should I use to filter it out?I tried to, but I couldn’t get it to work.I am using Arduino c++ code.

animefruit
 
Posts: 169
Joined: Tue Feb 25, 2020 1:04 pm

Re: Velosats

by adafruit_support_bill on Sun Mar 01, 2020 4:22 pm

The response from velostat varies widely from sample to sample. And a lot depends on how you build your sensor from it. If you can get substantially different readings from normal movement and projectile impact, then you should be able to filter out the normal movement.

adafruit_support_bill
 
Posts: 78979
Joined: Sat Feb 07, 2009 10:11 am

Re: Velosats

by animefruit on Mon Mar 02, 2020 1:09 am

This is Neal.I know I can filter out the normal reading rather than then the impact of things touching it.But my question is how to do that in my Arduino code.My code is something like this.410 is the value that I want the boundaries to do because the readings in my serial monitor like vary from 410-430


Analogread(A0)= reading;
If reading >= 410{
reading=0;
{

That is what I use and it still puts has readings that are 410-430.I don’t know what to do about it.

animefruit
 
Posts: 169
Joined: Tue Feb 25, 2020 1:04 pm

Re: Velosats

by adafruit_support_bill on Mon Mar 02, 2020 7:05 am

Your analogRead() doesn't do anything useful on the left side of an assignment. I'd be surprised if that even compiles.

adafruit_support_bill
 
Posts: 78979
Joined: Sat Feb 07, 2009 10:11 am

Re: Velosats

by animefruit on Mon Mar 02, 2020 9:19 am

This is Neal.Here is my actual full Arduino code.I am trying to filter out any reading greater than or equal to 410 on my serial monitor.Apparently it is not working though.Here it is:

Code: Select all | TOGGLE FULL SIZE
#include <Servo.h>
 Servo servo;
 int reading;   
 
void setup(void) {
 Serial.begin(9600);   
 servo.attach(9); //servo at digital pin 9
 servo.write(0); //initial point for servo

}
 
void loop(void) {
  reading = analogRead(A0); //attached to analog 0

 

 
  Serial.print("Sensor value = ");
 
  Serial.println(reading);

  if(reading >= 410){
    reading=0;
  }
     
   
 
 
 
//int value = map(reading, 0, 1023, 0, 255);

//servo.write(value);
 
 

   //if(analogRead(A0) >= 430 or analogRead(A0) >=410){
   
   
 
  delay(100);
}
Last edited by adafruit_support_bill on Mon Mar 02, 2020 10:07 am, edited 1 time in total.
Reason: Please use [code] tags when submitting code to the forums

animefruit
 
Posts: 169
Joined: Tue Feb 25, 2020 1:04 pm

Re: Velosats

by adafruit_support_bill on Mon Mar 02, 2020 10:09 am

The simplest thing to do is just ignore the reading:

Code: Select all | TOGGLE FULL SIZE
  if(reading >= 410)
  {
    return;
  }
     

adafruit_support_bill
 
Posts: 78979
Joined: Sat Feb 07, 2009 10:11 am

Re: Velosats

by animefruit on Mon Mar 02, 2020 10:23 am

This is Neal.I will try that later.And see if that will work.Thanyou.

animefruit
 
Posts: 169
Joined: Tue Feb 25, 2020 1:04 pm

Re: Velosats

by animefruit on Mon Mar 02, 2020 9:36 pm

This is Neal.That code you sent me did not work.So what other code could I use to filter out readings that are greater than 410?

animefruit
 
Posts: 169
Joined: Tue Feb 25, 2020 1:04 pm

Re: Velosats

by adafruit_support_bill on Tue Mar 03, 2020 6:41 am

That code you sent me did not work.

Can you be more specific? The code I posted completely ignores readings above 410. The problem must be elsewhere in your code.

adafruit_support_bill
 
Posts: 78979
Joined: Sat Feb 07, 2009 10:11 am

Re: Velosats

by animefruit on Tue Mar 03, 2020 6:34 pm

Where do you think the problem is with my code that is elsewhere?Here is my code:

Code: Select all | TOGGLE FULL SIZE
 #include <Servo.h>
 Servo servo;
 int reading;   
 
void setup(void) {
 Serial.begin(9600);   
 servo.attach(9); //servo at digital pin 9
 servo.write(0); //initial point for servo

}
 
void loop(void) {
  reading = analogRead(A0); //attached to analog 0

 

 
  Serial.print("Sensor value = ");
 
  Serial.println(reading);

  if(reading >= 410){
   return;
  }
     
   
 
 
 
//int value = map(reading, 0, 1023, 0, 255);

//servo.write(value);
 
 

   //if(analogRead(A0) >= 430 or analogRead(A0) >=410){
   
   
 
  delay(100);
}
Last edited by adafruit_support_bill on Tue Mar 03, 2020 6:38 pm, edited 1 time in total.
Reason: Pleas use [code] tags when posting code to the forums

animefruit
 
Posts: 169
Joined: Tue Feb 25, 2020 1:04 pm

Re: Velosats

by adafruit_support_bill on Tue Mar 03, 2020 6:40 pm

You are printing the value before filtering, so you will see all of the unfiltered values in your output.
Then after filtering, you don't do anything with what is left. The only thing in the loop after the filter is your delay.

adafruit_support_bill
 
Posts: 78979
Joined: Sat Feb 07, 2009 10:11 am

Re: Velosats

by animefruit on Tue Mar 03, 2020 7:14 pm

That worked to move it up But I still used reading=0 instead.But I need to somehow make it to where it still has values that are printed other than what it reads by without anything touching it.Do you know what code I should use for that?

animefruit
 
Posts: 169
Joined: Tue Feb 25, 2020 1:04 pm

Please be positive and constructive with your questions and comments.