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

PSoC™ 5, 3 & 1 Forum Discussions

user_3678521
Level 3
5 likes given First like given
Level 3

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
DheerajK_81
Moderator
Moderator First comment on KBA First comment on blog 5 questions asked
Moderator

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
user_3678521
Level 3
5 likes given First like given
Level 3

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
HeLi_263931
Level 8
100 likes received 50 likes received 25 likes received
Level 8

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

0 Likes
user_3678521
Level 3
5 likes given First like given
Level 3

Do you mean incease the stack or heep size?

0 Likes
DheerajK_81
Moderator
Moderator First comment on KBA First comment on blog 5 questions asked
Moderator

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
100 likes received 50 likes received 25 likes received
Level 8

Arduino Reference  shows you the actual implementation of this function.