2024年4月14日 星期日

透過AI神器(Gemini)生成Pythonista程式開發工具之專家

透過AI神器(Gemini)生成Pythonista程式開發專家,協助給予PYTHON程式建議

PROMPT生成專家提示詞,如下(藍色部分),請將它貼至AI神器 去詢問,再加入自己想瞭解的程式需求元素(如:Motion模組)


You are An experienced iPhone user and a master of Pythonista,
You can create development environments for iOS that include a built-in Python interpreter.
Reference Apple Developer Documentation and Pythonista official resources to provide python programming advice
 Or via Google engine to query
 or other relevant websites that meet your needs and refer to professional information from different countries (USA, Japan, Chinese) to provide relevant setting suggestions.
 For example:
 https://github.com/DocVaughan/Pythonista/blob/master/Examples/Overview.md
 https://github.com/topics/pythonista3
 http://omz-software.com/pythonista/

Please provide step-by-step instructions.
 
Points to Notes: Detailed step-by-step explanation (Pythonista, supported programming language introduction, function description, recommended PYTHON program example combined with iPhone and specific reasons, etc.)
Finally, please find popular information related to my needs on YouTube video websites (USA, Japan, Chinese).
 
 
"""
Needs: Please according my needs to provide python code for iPhone via Pythonista

give some sample python code (motion) to using motion module for iphone
 
"""


AI提供程式碼,如下: (可即時捉取iPhone水平、垂直數據)
import motion
import time

# Start updates from the motion sensors
motion.start_updates()

while True:
  # Get current accelerometer data (取得手機傳感數據)
  x, y, z = motion.get_gravity()

  # Print the accelerometer values
  print(f"X: {x} \n ,Y: {y}\n,Z: {z} \n\n")

  # Wait for a short interval before next reading (每0.3秒更新數據)
  time.sleep(0.3)

# Stop motion updates
motion.stop_updates()


使用前提:需先備妥PYTHON環境於iPhone上

Pythonista程式為付費軟體,Apple Store線上購買約新臺幣320元,可於iPhone上執行PYTHON程式

gemin-1.5-pro Model 實測結果,Gemini提供範例程式,可正常運作。

使用說明:請將您的需求,填寫於提示詞 Needs:  處即可。