EmbDev.net

Forum: ARM programming with GCC/GNU tools ARM Code for color sensor


von Neethu P (Guest)


Rate this post
useful
not useful
Sir,
I am using TCS3200 color sensor. In the data sheet, it is specified that 
the output of the mentioned sensor is frequency in the form of square 
pulses. How can I find out the frequency value from that output? Anyone 
have the code for TCS3200 color sensor with ARM LPC1769? Please help.

von M.K. B. (mkbit)


Rate this post
useful
not useful
You could use a pin which generates an interrupt on each rising edge of 
the color sensors signal. When you measure the time between the 
interrupts you can calculate the frequency.

von aaaB (Guest)


Rate this post
useful
not useful
Neethu P wrote:
> Sir,
> I am using TCS3200 color sensor. In the data sheet, it is specified that
> the output of the mentioned sensor is frequency in the form of square
> pulses. How can I find out the frequency value from that output? Anyone
> have the code for TCS3200 color sensor with ARM LPC1769? Please help.

You can connect the pin from the sensor that generates this waveform and 
connect it to an Oscilloscope or Logic Analyzer.

von charushilakhandait@gmail.com (Guest)


Rate this post
useful
not useful
aaaB wrote:
> aaaB

can u please share code for tcs3200 colour sensor as i am facing the 
same problem........plz

von charushilakhandait@gmail.com (Guest)


Rate this post
useful
not useful
Neethu P wrote:
> Sir,
> I am using TCS3200 color sensor. In the data sheet, it is specified that
> the output of the mentioned sensor is frequency in the form of square
> pulses. How can I find out the frequency value from that output? Anyone
> have the code for TCS3200 color sensor with ARM LPC1769? Please help.

can u please share code for tcs3200 colour sensor as i am facing the
same problem........plz

von void (Guest)


Rate this post
useful
not useful
charushilakhandait@gmail.com wrote:
> as i am facing the same problem

Uuh, you face the problem that you can't use a search engine with the 
terms 'TCS3200 color sensor code' too?
1
    /*     Arduino Color Sensing Tutorial
2
     *      
3
     *  by Dejan Nedelkovski, www.HowToMechatronics.com
4
     *  
5
     */
6
     
7
    #define S0 4
8
    #define S1 5
9
    #define S2 6
10
    #define S3 7
11
    #define sensorOut 8
12
    int frequency = 0;
13
    void setup() {
14
      pinMode(S0, OUTPUT);
15
      pinMode(S1, OUTPUT);
16
      pinMode(S2, OUTPUT);
17
      pinMode(S3, OUTPUT);
18
      pinMode(sensorOut, INPUT);
19
      
20
      // Setting frequency-scaling to 20%
21
      digitalWrite(S0,HIGH);
22
      digitalWrite(S1,LOW);
23
      
24
      Serial.begin(9600);
25
    }
26
    void loop() {
27
      // Setting red filtered photodiodes to be read
28
      digitalWrite(S2,LOW);
29
      digitalWrite(S3,LOW);
30
      // Reading the output frequency
31
      frequency = pulseIn(sensorOut, LOW);
32
      // Printing the value on the serial monitor
33
      Serial.print("R= ");//printing name
34
      Serial.print(frequency);//printing RED color frequency
35
      Serial.print("  ");
36
      delay(100);
37
      // Setting Green filtered photodiodes to be read
38
      digitalWrite(S2,HIGH);
39
      digitalWrite(S3,HIGH);
40
      // Reading the output frequency
41
      frequency = pulseIn(sensorOut, LOW);
42
      // Printing the value on the serial monitor
43
      Serial.print("G= ");//printing name
44
      Serial.print(frequency);//printing RED color frequency
45
      Serial.print("  ");
46
      delay(100);
47
      // Setting Blue filtered photodiodes to be read
48
      digitalWrite(S2,LOW);
49
      digitalWrite(S3,HIGH);
50
      // Reading the output frequency
51
      frequency = pulseIn(sensorOut, LOW);
52
      // Printing the value on the serial monitor
53
      Serial.print("B= ");//printing name
54
      Serial.print(frequency);//printing RED color frequency
55
      Serial.println("  ");
56
      delay(100);
57
    }
Code from the first search engine hit:
https://howtomechatronics.com/tutorials/arduino/arduino-color-sensing-tutorial-tcs230-tcs3200-color-sensor/

von Charusila K. (Company: neeri nagpur) (charu)


Rate this post
useful
not useful
I want the same arm code for colour sensor if you have then please 
provide me........waiting for the positive response

von void (Guest)



Rate this post
useful
not useful
Charusila K. wrote:
> I want the same arm code for colour sensor

The above provided code is for ARM Cortex-M3.
It compiles well for ARM Cortex-M3 e.g. Arduino Due board as shown 
attached.
If you need code for ARM mbed or LPCXpresso framworks for Cortex-M3 in 
LPC1769 you need to port it yourself.

Please log in before posting. Registration is free and takes only a minute.
Existing account
Do you have a Google/GoogleMail account? No registration required!
Log in with Google account
No account? Register here.