找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 7451|回复: 7
收起左侧

GY-9960-3.3APDS-9960模块源代码(RGB红外手势传感+感应运动方向识别)

[复制链接]
ID:402205 发表于 2018-9-25 15:37 | 显示全部楼层 |阅读模式
   GY-9960-3.3APDS-9960模块,RGB红外手势传感+感应运动方向识别模块,供大家学习使用。

arduino源程序如下:
  1. /****************************************************************
  2. ColorSensor.ino
  3. APDS-9960 RGB and Gesture Sensor
  4. Shawn Hymel @ SparkFun Electronics
  5. October 15, 2014
  6. https://github.com/sparkfun/APDS-9960_RGB_and_Gesture_Sensor

  7. Tests the color and ambient light sensing abilities of the
  8. APDS-9960. Configures APDS-9960 over I2C and polls the sensor for
  9. ambient light and color levels, which are displayed over the
  10. serial console.

  11. Hardware Connections:

  12. IMPORTANT: The APDS-9960 can only accept 3.3V!

  13. Arduino Pin  APDS-9960 Board  Function

  14. 3.3V         VCC              Power
  15. GND          GND              Ground
  16. A4           SDA              I2C Data
  17. A5           SCL              I2C Clock

  18. Resources:
  19. Include Wire.h and SparkFun_APDS-9960.h

  20. Development environment specifics:
  21. Written in Arduino 1.0.5
  22. Tested with SparkFun Arduino Pro Mini 3.3V

  23. This code is beerware; if you see me (or any other SparkFun
  24. employee) at the local, and you've found our code helpful, please
  25. buy us a round!

  26. Distributed as-is; no warranty is given.
  27. ****************************************************************/

  28. #include <Wire.h>
  29. #include <SparkFun_APDS9960.h>
  30. #include <LiquidCrystal.h>
  31. // Global Variables
  32. SparkFun_APDS9960 apds = SparkFun_APDS9960();
  33. uint16_t ambient_light = 0;
  34. uint16_t red_light = 0;
  35. uint16_t green_light = 0;
  36. uint16_t blue_light = 0;
  37. LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
  38. void setup() {
  39.   
  40.   // set up the LCD's number of columns and rows:
  41.   lcd.begin(16, 2);
  42.   // Print a message to the LCD.

  43.   
  44.   
  45.   // Initialize Serial port
  46.   Serial.begin(9600);
  47.   Serial.println();
  48.   Serial.println(F("--------------------------------"));
  49.   Serial.println(F("SparkFun APDS-9960 - ColorSensor"));
  50.   Serial.println(F("--------------------------------"));
  51.   
  52.   // Initialize APDS-9960 (configure I2C and initial values)
  53.   if ( apds.init() ) {
  54.     Serial.println(F("APDS-9960 initialization complete"));
  55.   } else {
  56.     Serial.println(F("Something went wrong during APDS-9960 init!"));
  57.   }
  58.   
  59.   // Start running the APDS-9960 light sensor (no interrupts)
  60.   if ( apds.enableLightSensor(false) ) {
  61.     Serial.println(F("Light sensor is now running"));
  62.   } else {
  63.     Serial.println(F("Something went wrong during light sensor init!"));
  64.   }
  65.   
  66.   // Wait for initialization and calibration to finish
  67.   delay(500);
  68. }

  69. void loop() {
  70.   
  71.   // Read the light levels (ambient, red, green, blue)
  72.   if (  !apds.readAmbientLight(ambient_light) ||
  73.         !apds.readRedLight(red_light) ||
  74.         !apds.readGreenLight(green_light) ||
  75.         !apds.readBlueLight(blue_light) ) {
  76.     Serial.println("Error reading light values");
  77.   } else {
  78.      
  79.     Serial.print("Ambient: ");
  80.     Serial.print(ambient_light);
  81.     lcd.setCursor(1, 0);
  82.      lcd.print(red_light);
  83.     Serial.print(" Red: ");
  84.     Serial.print(red_light);
  85.      lcd.setCursor(7, 0);
  86.       lcd.print(green_light);
  87.     Serial.print(" Green: ");
  88.     Serial.print(green_light);
  89.      lcd.setCursor(1, 1);
  90.      lcd.print(blue_light);
  91.     Serial.print(" Blue: ");
  92.     Serial.println(blue_light);
  93.   }
  94.   
  95.   // Wait 1 second before next reading
  96.   delay(10);
  97. }
复制代码

所有资料51hei提供下载:
GY-9960-3.3APDS-9960模块RGB红外手势传感 感应运动方向识别模块.zip (307.65 KB, 下载次数: 87)
回复

使用道具 举报

ID:104477 发表于 2018-10-11 02:03 来自手机 | 显示全部楼层
具体应用是什么
回复

使用道具 举报

ID:420962 发表于 2018-11-8 17:57 | 显示全部楼层
这个感应距离是多少,具体能感应哪些手势动作,有没有51的源码
回复

使用道具 举报

ID:297148 发表于 2018-11-10 17:21 | 显示全部楼层
APDS-9960现在流行吗?有没其他的手势产品可以做
回复

使用道具 举报

ID:461581 发表于 2019-1-5 17:10 | 显示全部楼层
不错,可以发给我邮箱吗,黑币不足,非常感谢
回复

使用道具 举报

ID:513258 发表于 2019-8-26 21:02 | 显示全部楼层
09.jpg
回复

使用道具 举报

ID:671549 发表于 2020-1-11 11:18 | 显示全部楼层
有没有51的源码  借鉴一下  非常感谢
回复

使用道具 举报

ID:672792 发表于 2020-1-24 19:55 | 显示全部楼层
好资料,感谢
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|51黑电子论坛 |51黑电子论坛6群 QQ 管理员QQ:125739409;技术交流QQ群281945664

Powered by 单片机教程网

快速回复 返回顶部 返回列表