PSoC 5LP Color sensor TCS3200

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
user_3678521
Level 3
Level 3
5 likes given First like given

Hello,

I'm working on useing a color sensor TCS3200, and first i wanted to know how it worked. So i used an arduino and tested in there because there is alot of help on the internet. Now i want to try to make it on PSoC creator. One thing i came across here is that on arduino they use a "map" function witch takes the value of a variable and converts it to a new range og values, like from 0 to 255. How can i make somthing like this on PSoC creator? is there already a funciton i dont know about?

Regards Mads

0 Likes
1 Solution

Hello Mads,

We do not have any such function by default, but you can implement the function yourself as already suggested. I tested your project and the UART is working. Make sure you have the right configurations set for the serial terminal. Since you are using the stdio and stdint libraries, which take up a lot of memory, increase both the stack size and the heap size.

Regards,

Dheeraj

View solution in original post

0 Likes
5 Replies
lock attach
Attachments are accessible only for community members.
user_3678521
Level 3
Level 3
5 likes given First like given

I also have another problem with my code (code is attached). I'm trying to read the frequence from my color sensor, and then print out the values. but my UART can't print in terminal window for some reason?

the reason why i set pins from high to low is for exaple: setting for RED (R) filtered photodiodes to be read (just to understand why i do what i do)

But the only thing i want, is to have my UART printing the different frequence of RGB.

Best regard Mads

0 Likes

When you want to use printf() with floating point, you need to increase the memory settings for your project.

0 Likes

Do you mean incease the stack or heep size?

0 Likes

Hello Mads,

We do not have any such function by default, but you can implement the function yourself as already suggested. I tested your project and the UART is working. Make sure you have the right configurations set for the serial terminal. Since you are using the stdio and stdint libraries, which take up a lot of memory, increase both the stack size and the heap size.

Regards,

Dheeraj

0 Likes
HeLi_263931
Level 8
Level 8
100 solutions authored 50 solutions authored 25 solutions authored

Arduino Reference  shows you the actual implementation of this function.