1from apify_client import ApifyClient
2
3
4
5client = ApifyClient("<YOUR_API_TOKEN>")
6
7
8run_input = { "calculations": [
9 {
10 "type": "ohms-law",
11 "voltage": 12,
12 "current": 0.5,
13 "label": "12 V at 0.5 A",
14 },
15 {
16 "type": "resistor-color-code",
17 "bands": [
18 "yellow",
19 "violet",
20 "red",
21 "gold",
22 ],
23 "label": "Decode a 4-band resistor",
24 },
25 {
26 "type": "resistor-color-code",
27 "resistance": "4.7k",
28 "bandCount": 5,
29 "label": "Encode 4.7 kohm to 5 bands",
30 },
31 {
32 "type": "led-resistor",
33 "supplyVoltage": 5,
34 "ledForwardVoltage": 2,
35 "ledCurrentMa": 20,
36 "numberOfLeds": 1,
37 "label": "Series resistor for a red LED",
38 },
39 {
40 "type": "voltage-divider",
41 "vin": 9,
42 "r1": "10k",
43 "r2": "4.7k",
44 "label": "9 V divider",
45 },
46 {
47 "type": "component-network",
48 "componentType": "resistor",
49 "connection": "parallel",
50 "values": [
51 "10k",
52 "10k",
53 ],
54 "label": "Two 10 kohm in parallel",
55 },
56 {
57 "type": "rc-filter",
58 "resistance": "10k",
59 "capacitance": "100n",
60 "label": "RC low-pass cutoff",
61 },
62 {
63 "type": "reactance",
64 "frequency": "1k",
65 "inductance": "10m",
66 "capacitance": "100n",
67 "label": "Reactance and LC resonance",
68 },
69 {
70 "type": "energy-cost",
71 "power": 60,
72 "hours": 720,
73 "energyRate": 0.15,
74 "currency": "USD",
75 "label": "60 W load for a month",
76 },
77 ] }
78
79
80run = client.actor("mangudai/electronics-calculator").call(run_input=run_input)
81
82
83print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
84for item in client.dataset(run["defaultDatasetId"]).iterate_items():
85 print(item)
86
87