Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Noob 1756

Pages: [1]
1
Projects and Designs / Re: Countdown counter using IR TCRT5000
« on: January 23, 2021, 06:13:34 PM »
A highly modified NerfGun, including backpack for 1000 rounds, counter, speed controller, semi-auto/burst/auto shoot...


here is my code
Code: [Select]
//Library
#include "SevenSeg.h"

// parameters
SevenSeg disp (10, 6, 4, 2, 1, 9, 5); //Defines the segments A-G: SevenSeg(A, B, C, D, E, F, G);
const int numOfDigits = 3;      //number of digits
int digitPins [numOfDigits] = {11, 8, 7}; //CC(or CA) pins of segment

//Variables
int AmmoCount; // Ammo_current_count
int AmmoMax; // Ammo_full magazine
int Threshold;
int inLEDvar;
int inLEDvarState;
int inLEDvarLastState;
int outLEDvar;
int outLEDvarState;
int outLEDvarLastState;



void setup()
{
  pinMode (A0, INPUT); // in_LED_Sensor
  pinMode (A1,INPUT);  // out_LED_Sensor
  Threshold = 950;
  AmmoMax = 100;
  AmmoCount = AmmoMax;
  disp.setRefreshRate(150);
  inLEDvarLastState = 0;
  inLEDvarState = 0;
  outLEDvarLastState = 0;
  outLEDvarState = 0;
  disp.setDigitPins ( numOfDigits , digitPins );
  disp.setCommonAnode();
}

void loop()
{
  disp.write(AmmoCount);
  inLEDvar = analogRead (A0); // read in_LED_Sensor
  outLEDvar = analogRead (A1); // read out_LED_Sensor
  if (inLEDvar > Threshold)
  {
    inLEDvarState = 1;
    if (inLEDvarState != inLEDvarLastState)
    {
      if (AmmoCount == 0)
      {
        disp.write("000");
      }
      else
      {
        AmmoCount = AmmoCount - 1;
        inLEDvarState = 0;
      }
    }
    else
    {
      inLEDvar = 0;
      inLEDvarLastState = inLEDvarState;
    }
  }
}

2
Support and feedback / Re: Profile photo
« on: January 20, 2021, 12:12:55 AM »
its fixed, picture too big. thx

3
Support and feedback / Profile photo
« on: January 17, 2021, 06:16:17 PM »
I cannot upload any photo to my profile.

4
Projects and Designs / Countdown counter using IR TCRT5000
« on: January 17, 2021, 06:10:53 PM »
Hello all,

I need help for a small project I am actually working on.

An Arduino got two analog IR sensors, these are working fine.
Also a 3digit 7 segments LED display is connected to the Arduino, also working fine.

Here is where is getting tricky, I need to detect an object passing in front of the both sensor, then decrease a counter on the display.
My problem is when an object pass the first sensor, the countdown start but not stop, going fast to zero, not to count -1.



Pages: [1]